Bug 1427870 - Change resolution of .now() to 20us. r=bkelly, a=lizzard
authorTom Ritter <tom@mozilla.com>
Sat, 30 Dec 2017 13:07:00 -0600
changeset 397701 c9bec96cc78978b5282185534d7e7c8c436e7822
parent 397700 2368bc8e65daba4232b31e607edc666d2f47a63b
child 397702 7953a76fef1f40a4f38e8b428bd1655d199e432f
child 397705 d382313f3e5b26e4863cabf38c18876171f4fb4d
child 397728 6f98c6b22ae6bda54a61859c74a5fd8d0e610741
push id57495
push userryanvm@gmail.com
push dateWed, 03 Jan 2018 23:01:51 +0000
treeherderautoland@7953a76fef1f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, lizzard
bugs1427870, 1186489, 1278838
milestone59.0a1
first release with
nightly linux32
c9bec96cc789 / 59.0a1 / 20180103230158 / files
nightly linux64
c9bec96cc789 / 59.0a1 / 20180103230158 / files
nightly mac
c9bec96cc789 / 59.0a1 / 20180103230158 / files
nightly win32
c9bec96cc789 / 59.0a1 / 20180103230158 / files
nightly win64
c9bec96cc789 / 59.0a1 / 20180103230158 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
@@ -238,20 +238,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)
 {