User:Lupin/sandbox/popups.diff

--- popups.orig.js	2005-12-06 17:53:40.000000000 -0800 +++ popups.js	2005-12-06 18:01:03.000000000 -0800 @@ -1191,6 +1191,8 @@ // // +var gDownloadsInProgress = { }; + function downloader(url) { // Source: http://jibbering.com/2002/4/httprequest.html this.http = false; @@ -1225,9 +1227,14 @@ downloader.prototype.runCallback = function {this.callbackFunction(this);}; downloader.prototype.getData = function {if(!this.http) return null; return this.http.responseText;}; downloader.prototype.setTarget = function {if(!this.http) return null; this.http.open("GET", this.url, true);}; -downloader.prototype.start=function {if(!this.http) return null; return this.http.send(null);}; downloader.prototype.getReadyState=function {if(!this.http) return null; return this.http.readyState;}; +downloader.prototype.start=function { + if(!this.http) return null; + gDownloadsInProgress[this.id] = this; + return this.http.send(null); +}; + downloader.prototype.getLastModifiedDate=function { if(!this.http) return null; var lastmod=null; @@ -1252,6 +1259,7 @@  d.setTarget; var f = function { if (d.getReadyState == 4) { +     delete gDownloadsInProgress[this.id]; d.data=d.getData; d.lastModified=d.getLastModifiedDate; callback(d); @@ -1274,6 +1282,15 @@  return d.start; }; +function abortAllDownloads { + for ( var x in gDownloadsInProgress ) { +   try { +     gDownloadsInProgress[x].abort; +     delete gDownloadsInProgress[x]; +   } catch (e) { } + } +}; + // // // downloader @@ -1329,18 +1346,6 @@  return gCachedPages.push(page); }; -/* - var gCurrentDownload = null; - - function abortCurrentDownload(download) { - if (gCurrentDownload) { - try { gCurrentDownload.abort; } - catch (anerror) {return 'could not abort download object';} - } -  return true; - } -*/ - ///////////////////// // LINK GENERATION // @@ -2946,7 +2951,7 @@  if (getValueOf('popupShortcutKeys')) rmPopupShortcuts; cClick; window.currentLink=null; - // abortCurrentDownload; + abortAllDownloads; stopImagesDownloading; if (checkPopupPositionTimer != null) { clearInterval(checkPopupPositionTimer); checkPopupPositionTimer=null; } if (checkImagesTimer != null) { clearInterval(checkImagesTimer); checkImagesTimer=null; }