Changeset 7961

Show
Ignore:
Timestamp:
04/06/07 17:11:34 (21 months ago)
Author:
alex
Message:

removing async options for _getText. It was completely unused. Refs #2500

Location:
dojo/trunk/_base/_loader
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/_loader/hostenv_browser.js

    r7947 r7961  
    9191                                        } 
    9292                                } 
    93  
    94                                 /*if(http && !http.toString) { 
    95                                         http.toString = function() { "[object XMLHttpRequest]"; } 
    96                                 }*/ 
    9793                        } 
    9894 
     
    111107                } 
    112108 
    113                 d._blockAsync = false; 
    114                 d._getText = function(uri, async_cb, fail_ok){ 
     109                d._getText = function(uri, fail_ok){ 
    115110                        // summary: Read the contents of the specified uri and return those contents. 
    116111                        // uri: 
    117112                        //              A relative or absolute uri. If absolute, it still must be in 
    118113                        //              the same "domain" as we are. 
    119                         // async_cb: 
    120                         //              If not specified, load synchronously. If specified, load 
    121                         //              asynchronously, and use async_cb as the progress handler which 
    122                         //              takes the xmlhttp object as its argument. If async_cb, this 
    123                         //              function returns null. 
    124114                        // fail_ok: 
    125                         //              Default false. If fail_ok and !async_cb and loading fails, 
    126                         //              return null instead of throwing. 
    127  
    128                         // need to block async callbacks from snatching this thread as the result 
    129                         // of an async callback might call another sync XHR, this hangs khtml forever 
    130                         // hostenv._blockAsync must also be checked in BrowserIO's watchInFlight() 
     115                        //              Default false. If fail_ok and loading fails, return null 
     116                        //              instead of throwing. 
     117 
    131118                        // NOTE: must be declared before scope switches ie. this._xhrObj() 
    132                         if(!async_cb){ this._blockAsync = true; } 
    133  
    134119                        var http = this._xhrObj(); 
    135120 
    136                         if(async_cb){ 
    137                                 var _this = this, timer = null, gbl = dojo.global(); 
    138                                 http.onreadystatechange = function(){ 
    139                                         if(timer){ gbl.clearTimeout(timer); timer = null; } 
    140                                         if(_this._blockAsync){ 
    141                                                 timer = gbl.setTimeout(function(){ 
    142                                                         http.onreadystatechange.apply(this); 
    143                                                 }, 10); 
    144                                         }else{ 
    145                                                 if(4==http.readyState){ 
    146                                                         if(isDocumentOk(http)){ 
    147                                                                 // console.debug("LOADED URI: "+uri); 
    148                                                                 async_cb(http.responseText); 
    149                                                         } 
    150                                                 } 
    151                                         } 
    152                                 } 
    153                         } 
    154  
    155                         http.open('GET', uri, async_cb ? true : false); 
     121                        http.open('GET', uri, false); 
    156122                        try{ 
    157123                                http.send(null); 
    158                                 if(async_cb){ 
    159                                         return null; 
    160                                 } 
    161124                                if(!isDocumentOk(http)){ 
    162125                                        var err = Error("Unable to load "+uri+" status:"+ http.status); 
     
    166129                                } 
    167130                        }catch(e){ 
    168                                 this._blockAsync = false; 
    169                                 if((fail_ok)&&(!async_cb)){ 
    170                                         return null; 
    171                                 }else{ 
    172                                         throw e; 
    173                                 } 
    174                         } 
    175  
    176                         this._blockAsync = false; 
     131                                if(fail_ok){ return null; } 
     132                                throw e; 
     133                        } 
    177134                        return http.responseText; // String 
    178135                } 
  • dojo/trunk/_base/_loader/loader.js

    r7882 r7961  
    108108                return true; // Boolean 
    109109        } 
    110         var contents = this._getText(uri, null, true); 
     110        var contents = this._getText(uri, true); 
    111111        if(!contents){ return false; } // Boolean 
    112112        this._loadedUrls[uri] = true;