Changeset 5539
- Timestamp:
- 12/20/07 12:28:51 (1 year ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Ajax.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Tile/WFS.js (modified) (3 diffs)
- trunk/openlayers/tests/Tile/test_WFS.html (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Ajax.js
r5535 r5539 46 46 * params - {String} Params on get (doesnt seem to work) 47 47 * caller - {Object} object which gets callbacks 48 * onComplete - {Function} callback for success 49 * onFailure - {Function} callback for failure 50 * 51 * Both callbacks optional (though silly) 48 * onComplete - {Function} Optional callback for success. The callback 49 * will be called with this set to caller and will receive the request 50 * object as an argument. 51 * onFailure - {Function} Optional callback for failure. In the event of 52 * a failure, the callback will be called with this set to caller and will 53 * receive the request object as an argument. 54 * 55 * Returns: 56 * {OpenLayers.Ajax.Request} The request object. To abort loading, call 57 * request.transport.abort(); 52 58 */ 53 59 OpenLayers.loadURL = function(uri, params, caller, … … 65 71 66 72 // from prototype.js 67 new OpenLayers.Ajax.Request(uri, 68 { method: 'get', 69 parameters: params, 70 onComplete: success, 71 onFailure: failure 72 } 73 ); 73 return new OpenLayers.Ajax.Request( 74 uri, 75 { 76 method: 'get', 77 parameters: params, 78 onComplete: success, 79 onFailure: failure 80 } 81 ); 74 82 }; 75 83 trunk/openlayers/lib/OpenLayers/Tile/WFS.js
r4985 r5539 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() … … 58 64 this.features = null; 59 65 this.url = null; 66 if(this.request) { 67 this.request.transport.abort(); 68 } 60 69 }, 61 70 … … 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 trunk/openlayers/tests/Tile/test_WFS.html
r4227 r5539 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 … … 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 … … 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
