Browse Source

Improved custom settings parsing

dosse91 9 years ago
parent
commit
b0172cc108
2 changed files with 5 additions and 1 deletions
  1. 5 1
      speedtest_worker.js
  2. 0 0
      speedtest_worker.min.js

+ 5 - 1
speedtest_worker.js

@@ -68,7 +68,11 @@ this.addEventListener('message', function (e) {
     testStatus = 1
     try {
       // parse settings, if present
-      var s = JSON.parse(e.data.substring(5))
+      var s = {}
+      try{
+        var ss = e.data.substring(5);
+        if (ss) s = JSON.parse(ss);
+      }catch(e){ console.warn("Error parsing custom settings JSON. Please check your syntax"); }
       if (typeof s.url_dl !== 'undefined') settings.url_dl = s.url_dl // download url
       if (typeof s.url_ul !== 'undefined') settings.url_ul = s.url_ul // upload url
       if (typeof s.url_ping !== 'undefined') settings.url_ping = s.url_ping // ping url

File diff suppressed because it is too large
+ 0 - 0
speedtest_worker.min.js


Some files were not shown because too many files changed in this diff