зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1439657 Remove Time Precision Reduction from Console Timestamps r=baku
We currently reduce the precision of timestamps emitted by console.time in the main context, but not in a Worker. Because web page content cannot read the content of messages emitted to the console (right?), we don't actually need to reduce the precision of this data. MozReview-Commit-ID: EfpIEICy0tX --HG-- extra : rebase_source : 9516943b11dd7d4ccbcf38a80a981a6fb4662c40
This commit is contained in:
Родитель
e7f05a5bd0
Коммит
13b982d13e
|
@ -2544,14 +2544,7 @@ Console::MonotonicTimer(JSContext* aCx, MethodName aMethodName,
|
|||
}
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
double duration = (TimeStamp::Now() - mCreationTimeStamp).ToMilliseconds();
|
||||
|
||||
// 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;
|
||||
*aTimeStamp = nsRFPService::ReduceTimePrecisionAsMSecs(
|
||||
floor(duration / maxResolutionMs) * maxResolutionMs);
|
||||
*aTimeStamp = (TimeStamp::Now() - mCreationTimeStamp).ToMilliseconds();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче