зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1440195 For timestamps that are absolute, specify a null context pointer r=baku
Note that by not using the same context pointer for all timestamps within a single 'communication group' (that is, all things that can communication to each other in JavaScript), it's possible to observe time going backwards. Imagine comparing performance.timeOrigin + performance.now() < new File([], "").lastModified In theory this should always be true. However, if performance.now() was jittered up (using one context pointer, because it is a relative timestamp) and File was jittered down (using a null context pointer, because it is an absolute timestamp) then this may evaluate to False. I think this is okay. MozReview-Commit-ID: BfgbmGS8XdD --HG-- extra : rebase_source : 1d105d9b63e61561be06dbfe2a3fccf534ee68b3
This commit is contained in:
Родитель
748c732d15
Коммит
16f0facaae
|
@ -64,7 +64,8 @@ BaseBlobImpl::GetLastModified(ErrorResult& aRv)
|
|||
{
|
||||
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||
if (IsDateUnknown()) {
|
||||
mLastModificationDate = nsRFPService::ReduceTimePrecisionAsUSecs(PR_Now());
|
||||
mLastModificationDate = nsRFPService::ReduceTimePrecisionAsUSecs(PR_Now(), 0);
|
||||
// mLastModificationDate is an absolute timestamp so we supply a zero context mix-in
|
||||
}
|
||||
|
||||
return mLastModificationDate / PR_USEC_PER_MSEC;
|
||||
|
|
|
@ -269,7 +269,8 @@ MultipartBlobImpl::SetLengthAndModifiedDate(ErrorResult& aRv)
|
|||
// x.getTime() < f.dateModified.getTime()
|
||||
// could fail.
|
||||
mLastModificationDate = nsRFPService::ReduceTimePrecisionAsUSecs(
|
||||
lastModifiedSet ? lastModified * PR_USEC_PER_MSEC : JS_Now());
|
||||
lastModifiedSet ? lastModified * PR_USEC_PER_MSEC : JS_Now(), 0);
|
||||
// mLastModificationDate is an absolute timestamp so we supply a zero context mix-in
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -557,7 +557,7 @@ nsRFPService::ReduceTimePrecisionAsUSecsWrapper(double aTime)
|
|||
aTime,
|
||||
MicroSeconds,
|
||||
TimerResolution(),
|
||||
0,
|
||||
0, /* For absolute timestamps (all the JS engine does), supply zero context mixin */
|
||||
TimerPrecisionType::All);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче