From e87c8c861b0f63d3ddc7ead1cb775df2daf930ce Mon Sep 17 00:00:00 2001 From: dosse91 Date: Sun, 26 Feb 2017 08:26:42 +0100 Subject: [PATCH] More aggressive stopping of XHR requests --- speedtest_worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/speedtest_worker.js b/speedtest_worker.js index 0c3958d..7799605 100644 --- a/speedtest_worker.js +++ b/speedtest_worker.js @@ -41,7 +41,7 @@ function dlTest(done){ prevLoaded=event.loaded; prevT=new Date().getTime(); dlStatus=((speed*8)/1048576.0).toFixed(2); - if(((prevT-startT)/1000.0)>settings.time_dl){try{xhr.abort();}catch(e){} xhr=null; done();} + if(((prevT-startT)/1000.0)>settings.time_dl){xhr.onprogress=null; xhr.onload=null; xhr.onerror=null; try{xhr.abort();}catch(e){} xhr=null; done();} }.bind(this); xhr.onload=function(){ prevT=new Date().getTime(); prevLoaded=0; fistTick=true; @@ -73,7 +73,7 @@ function ulTest(done){ prevLoaded=event.loaded; prevT=new Date().getTime(); ulStatus=((speed*8)/1048576.0).toFixed(2); - if(((prevT-startT)/1000.0)>settings.time_ul){try{xhr.abort();}catch(e){} xhr=null; done();} + if(((prevT-startT)/1000.0)>settings.time_ul){xhr.upload.onprogress=null; xhr.upload.onload=null; xhr.upload.onerror=null; try{xhr.abort();}catch(e){} xhr=null; done();} }.bind(this); xhr.upload.onload=function(){ prevT=new Date().getTime(); prevLoaded=0; fistTick=true;