Worker will now escape text from getIP, just in case...
This commit is contained in:
parent
a7dd0fef52
commit
dac7e7e9c8
|
@ -17,6 +17,11 @@ var ulProgress = 0 //progress of upload test 0-1
|
|||
var pingProgress = 0 //progress of ping+jitter test 0-1
|
||||
var testId = 'noID' //test ID (sent back by telemetry if used, the string 'noID' otherwise)
|
||||
|
||||
var HTML_ESCAPE_MAP={'&': '&','<': '<','>': '>','"': '"',"'": '''};
|
||||
String.prototype.escapeHtml=function(){
|
||||
return this.replace(/[&<>"']/g, function(m){return HTML_ESCAPE_MAP[m]});
|
||||
}
|
||||
|
||||
var log='' //telemetry log
|
||||
function tlog(s){log+=Date.now()+': '+s+'\n'}
|
||||
function twarn(s){log+=Date.now()+' WARN: '+s+'\n'; console.warn(s)}
|
||||
|
@ -176,10 +181,10 @@ function getIp (done) {
|
|||
tlog("IP: "+xhr.responseText)
|
||||
try{
|
||||
var data=JSON.parse(xhr.responseText)
|
||||
clientIp=data.processedString
|
||||
clientIp=data.processedString.escapeHtml()
|
||||
ispInfo=data.rawIspInfo
|
||||
}catch(e){
|
||||
clientIp = xhr.responseText
|
||||
clientIp = xhr.responseText.escapeHtml()
|
||||
ispInfo=''
|
||||
}
|
||||
done()
|
||||
|
|
2
speedtest_worker.min.js
vendored
2
speedtest_worker.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue