[tor-bugs] #18279 [Applications/Tor Browser]: Javascript setTimeout can be used for high resolution clock

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon May 20 16:38:36 UTC 2019


#18279: Javascript setTimeout can be used for high resolution clock
--------------------------------------+--------------------------
 Reporter:  cypherpunks               |          Owner:  tbb-team
     Type:  defect                    |         Status:  new
 Priority:  Medium                    |      Milestone:
Component:  Applications/Tor Browser  |        Version:
 Severity:  Normal                    |     Resolution:
 Keywords:                            |  Actual Points:
Parent ID:  #16110                    |         Points:
 Reviewer:                            |        Sponsor:
--------------------------------------+--------------------------

Comment (by Thorin):

 This can be closed as resolved fixed: unless you wanted to test them over
 workers, service workers (which are disabled in Private Mode), iframes.
 Timing is clamped by RFP

 **setTimeout**
 {{{
 <html><title>setTimeout</title><body onload="run()"><html>
 <body>
 <p>setTimeout</p>
 <button id="run" onClick="run()">run again</button><br><br>
 <textarea rows="50" id="r"></textarea>
 <script>
 var counter=1; var r="";
 function logTime() {
   if (counter < 201) {
                 var today = new Date();
                 r = r+(today.getSeconds() +"."+ today.getMilliseconds() +"
 "+ counter +"\n");
                 var t = setTimeout(logTime, 1);
                 counter += 1;
                 if (counter == 201)
 {document.getElementById("r").innerHTML=r}
         };
 };
 function run() {
         counter=1; r="";
         document.getElementById("r").innerHTML=r;
         logTime();
 };
 </script>
 </body>
 </html>
 }}}

 **setInterval**
 {{{
 <html><title>setInterval</title><body onload="run()"><html>
 <body>
 <p>setInterval</p>
 <button id="run" onClick="run()">run again</button><br><br>
 <textarea rows="50" id="r"></textarea>
 <script>
 var counter = 1; var r="";
 function logTime() {
         setInterval(function(){
                 if (counter < 201) {
                         var today = new Date();
                         r = r+(today.getSeconds() +"."+
 today.getMilliseconds() +" "+ counter +"\n");
                         counter += 1;
                         if (counter == 201)
 {document.getElementById("r").innerHTML=r;}
                 };
         }, 10);
 };
 function run() {
         counter = 1; r="";
         document.getElementById("r").innerHTML=r;
         logTime();
 };
 </script>
 </body>
 </html>
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18279#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list