Bug 1427870 - Change resolution of .now() to 20us. r=bkelly, a=lizzard FENNEC_57_0_4_BUILD1 FENNEC_57_0_4_RELEASE FIREFOX_57_0_4_BUILD1 FIREFOX_57_0_4_RELEASE
authorTom Ritter <tom@mozilla.com>
Sat, 30 Dec 2017 13:07:00 -0600
changeset 435413 afa87f9be3a8852da3a30f286b15ae599c7874f6
parent 435412 6caa457ebedc915b43dc1d054b8fe22e82ca7447
child 435414 4d3497f26bc179ce5632719a808e32335e8cec4d
push id1612
push userryanvm@gmail.com
push dateWed, 03 Jan 2018 23:10:32 +0000
treeherdermozilla-release@afa87f9be3a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, lizzard
bugs1427870, 1186489, 1278838
milestone57.0.4
Bug 1427870 - Change resolution of .now() to 20us. r=bkelly, a=lizzard The comment about workers was introduced in Bug 1186489 but became obsolete some time after that (definitely by Bug 1278838)
dom/performance/Performance.cpp
--- a/dom/performance/Performance.cpp
+++ b/dom/performance/Performance.cpp
@@ -234,20 +234,19 @@ Performance::ClearResourceTimings()
 {
   MOZ_ASSERT(NS_IsMainThread());
   mResourceEntries.Clear();
 }
 
 DOMHighResTimeStamp
 Performance::RoundTime(double aTime) const
 {
-  // Round down to the nearest 5us, because if the timer is too accurate people
-  // can do nasty timing attacks with it.  See similar code in the worker
-  // Performance implementation.
-  const double maxResolutionMs = 0.005;
+  // Round down to the nearest 20us, because if the timer is too accurate people
+  // can do nasty timing attacks with it.
+  const double maxResolutionMs = 0.020;
   return nsRFPService::ReduceTimePrecisionAsMSecs(
     floor(aTime / maxResolutionMs) * maxResolutionMs);
 }
 
 
 void
 Performance::Mark(const nsAString& aName, ErrorResult& aRv)
 {