OpenLayers OpenLayers

Changeset 6408

Show
Ignore:
Timestamp:
02/28/08 19:16:47 (11 months ago)
Author:
tschaub
Message:

The loadURL function now returns something that acts more like XMLHttpRequest should. If you name this return request, call request.abort to abort the request. r=crschmidt (closes #1386)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Ajax.js

    r6313 r6408  
    5454 * 
    5555 * Returns: 
    56  * {OpenLayers.Ajax.Request}  The request object.  To abort loading, call 
    57  *     request.transport.abort(); 
     56 * {XMLHttpRequest}  The request object.  To abort loading, call 
     57 *     request.abort(). 
    5858 */ 
    5959OpenLayers.loadURL = function(uri, params, caller, 
     
    6767 
    6868    // from prototype.js 
    69     return new OpenLayers.Ajax.Request( 
     69    var request = new OpenLayers.Ajax.Request( 
    7070        uri,  
    7171        { 
     
    7676        } 
    7777    ); 
     78    return request.transport; 
    7879}; 
    7980 
  • trunk/openlayers/lib/OpenLayers/Tile/WFS.js

    r5839 r6408  
    6767        this.url = null; 
    6868        if(this.request) { 
    69             this.request.transport.abort(); 
     69            this.request.abort(); 
    7070            //this.request.destroy(); 
    7171            this.request = null; 
     
    112112    loadFeaturesForRegion:function(success, failure) { 
    113113        if(this.request) { 
    114             this.request.transport.abort(); 
    115             //this.request.destroy(); 
     114            this.request.abort(); 
    116115        } 
    117116        this.request = OpenLayers.loadURL(this.url, null, this, success); 
  • trunk/openlayers/tests/Tile/test_WFS.html

    r6400 r6408  
    7373      //running request (cancelled) -- 4 tests + 1 test (for request abort) 
    7474        tile.request = { 
    75             transport: { 
    76                 'abort': function() { 
    77                         t.ok(true, "request aborted"); 
    78                 } 
     75            'abort': function() { 
     76                    t.ok(true, "request aborted"); 
    7977            } 
    8078        }; 
     
    10199        var _gAbort = false;  
    102100        tile.request = {  
    103             transport: {  
    104                 abort: function() {  
    105                     _gAbort = true;  
    106                 }  
     101            abort: function() {  
     102                _gAbort = true;  
    107103            }  
    108104        }  
  • trunk/openlayers/tests/manual/ajax.html

    r6346 r6408  
    11<html xmlns="http://www.w3.org/1999/xhtml"> 
    22  <head> 
    3     <title>Draw Feature Acceptance Test</title> 
     3    <title>Ajax Acceptance Test</title> 
    44    <style type="text/css"> 
    55     
     
    6565      <li>synchronous: "request completed" then "other processing"</li> 
    6666      <li>asynchronous: "other processing" then "request completed"</li> 
    67       <li>abort: "request aborted" then "other processing"</li> 
     67      <li>abort: "request aborted" then "other processing" (note that real XHR behavior would not call onComplete with abort - meaning "request aborted" would not be displayed here)</li> 
    6868    </ul> 
    6969  </body>