Changeset 543

Show
Ignore:
Timestamp:
09/10/08 00:39:45 (4 months ago)
Author:
heyadayo
Message:

fix navigate/close errors with firefox xhrstream due to heartbeats

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.7/daemon/orbited/static/Orbited.js

    r542 r543  
     1 
    12// NOTE: to log/debug with Orbited, there are two methods: 
    23//          Use firebug  
     
    592593;;;     self.logger.debug('transportOnClose'); 
    593594        if (self.readyState < self.READY_STATE_CLOSED) { 
    594             doClose(Orbited.Statuses.ServerClosedConnection) 
     595            try { 
     596                doClose(Orbited.Statuses.ServerClosedConnection) 
     597            } 
     598            catch(e) { 
     599//              Fix for navigation-close 
     600                return 
     601            } 
    595602        } 
    596603    }         
     
    11621169                        // If we got a 200, then we're in business 
    11631170                        if (status == 200) { 
    1164                             heartbeatTimer = window.setTimeout(heartbeatTimeout, Orbited.settings.HEARTBEAT_TIMEOUT); 
     1171                            try { 
     1172                                heartbeatTimer = window.setTimeout(heartbeatTimeout, Orbited.settings.HEARTBEAT_TIMEOUT); 
     1173                            } 
     1174                            catch(e) { 
     1175//                               Happens after navigation 
     1176                                 self.close() 
     1177                                 return 
     1178                            } 
    11651179                            var testtimer = heartbeatTimer; 
    11661180                        } 
     
    12441258//            self.logger.debug('do abort..') 
    12451259            xhr.abort(); 
    1246             window.clearTimeout(heartbeatTimer);             
     1260            window.clearTimeout(heartbeatTimer); 
    12471261        } 
    12481262        else { 
     
    13071321        window.clearTimeout(heartbeatTimer); 
    13081322;;;     self.logger.debug('clearing heartbeatTimer', heartbeatTimer) 
    1309         heartbeatTimer = window.setTimeout(function() {  
     1323        try { 
     1324            heartbeatTimer = window.setTimeout(function() {  
    13101325;;;         self.logger.debug('timer', testtimer, 'did it');  
    1311             heartbeatTimeout(); 
    1312         }, Orbited.settings.HEARTBEAT_TIMEOUT); 
     1326                heartbeatTimeout(); 
     1327            }, Orbited.settings.HEARTBEAT_TIMEOUT); 
     1328        } 
     1329        catch(e) { 
     1330             
     1331            return 
     1332        } 
    13131333        var testtimer = heartbeatTimer; 
    13141334