[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-45.2.0esr-6.5-1] squash! Bug 1517: Reduce precision of time for Javascript.



commit f2291c41ff45ff3108ef05539fadf7fafac2e7cd
Author: Arthur Edelstein <arthuredelstein@xxxxxxxxx>
Date:   Tue Jun 21 14:31:45 2016 -0700

    squash! Bug 1517: Reduce precision of time for Javascript.
    
    Bug 19478: Prevent File API from leaking ms-resolution current time
---
 dom/base/File.cpp              | 3 ++-
 dom/base/MultipartBlobImpl.cpp | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dom/base/File.cpp b/dom/base/File.cpp
index 5cc20a7..694f8fb 100644
--- a/dom/base/File.cpp
+++ b/dom/base/File.cpp
@@ -750,7 +750,8 @@ BlobImplBase::GetLastModified(ErrorResult& aRv)
 {
   NS_ASSERTION(mIsFile, "Should only be called on files");
   if (IsDateUnknown()) {
-    mLastModificationDate = PR_Now();
+    // Round to nearest 100 ms.
+    mLastModificationDate = floor(PR_Now() / 100000) * 100000;
   }
 
   return mLastModificationDate / PR_USEC_PER_MSEC;
diff --git a/dom/base/MultipartBlobImpl.cpp b/dom/base/MultipartBlobImpl.cpp
index 9867142..b1e088a 100644
--- a/dom/base/MultipartBlobImpl.cpp
+++ b/dom/base/MultipartBlobImpl.cpp
@@ -273,7 +273,9 @@ MultipartBlobImpl::SetLengthAndModifiedDate(ErrorResult& aRv)
     //   x.getTime() < f.dateModified.getTime()
     // could fail.
     mLastModificationDate =
-      lastModifiedSet ? lastModified * PR_USEC_PER_MSEC : JS_Now();
+      lastModifiedSet ? lastModified * PR_USEC_PER_MSEC
+                      // Round to nearest 100 ms
+                      : floor(JS_Now() / 100000) * 100000;
   }
 }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits