Bug 1585589 - Do not reduce the precision of the requestAnimationFrame timestamp if we are in the System Principal Context r=birtles
authorTom Ritter <tom@mozilla.com>
Thu, 03 Oct 2019 22:53:28 +0000
changeset 496269 c38b3c03d21feedfbce28e0ca1bff0269c35c5e6
parent 496268 ecb0e3d35a47ef3e11938d256522e187aee57450
child 496270 176b3b3a6fab041cc82264e96f1b97dfd3d0a0b5
push id97141
push usertritter@mozilla.com
push dateThu, 03 Oct 2019 23:34:24 +0000
treeherderautoland@c38b3c03d21f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1585589
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1585589 - Do not reduce the precision of the requestAnimationFrame timestamp if we are in the System Principal Context r=birtles Differential Revision: https://phabricator.services.mozilla.com/D48118
layout/base/nsRefreshDriver.cpp
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -1701,21 +1701,24 @@ void nsRefreshDriver::RunFrameRequestCal
       // window in some cases.
       nsPIDOMWindowInner* innerWindow =
           docCallbacks.mDocument->GetInnerWindow();
       DOMHighResTimeStamp timeStamp = 0;
       if (innerWindow) {
         mozilla::dom::Performance* perf = innerWindow->GetPerformance();
         if (perf) {
           timeStamp = perf->GetDOMTiming()->TimeStampToDOMHighRes(aNowTime);
-          // 0 is an inappropriate mixin for this this area; however CSS Animations
-          // needs to have it's Time Reduction Logic refactored, so it's currently
-          // only clamping for RFP mode. RFP mode gives a much lower time precision,
-          // so we accept the security leak here for now
-          timeStamp = nsRFPService::ReduceTimePrecisionAsMSecs(timeStamp, 0, TimerPrecisionType::RFPOnly);
+          // 0 is an inappropriate mixin for this this area; however CSS
+          // Animations needs to have it's Time Reduction Logic refactored, so
+          // it's currently only clamping for RFP mode. RFP mode gives a much
+          // lower time precision, so we accept the security leak here for now
+          if (!perf->IsSystemPrincipal()) {
+            timeStamp = nsRFPService::ReduceTimePrecisionAsMSecs(
+                timeStamp, 0, TimerPrecisionType::RFPOnly);
+          }
         }
         // else window is partially torn down already
       }
       for (auto& callback : docCallbacks.mCallbacks) {
         if (docCallbacks.mDocument->IsCanceledFrameRequestCallback(
                 callback.mHandle)) {
           continue;
         }
@@ -2129,17 +2132,17 @@ void nsRefreshDriver::Tick(VsyncId aId, 
 #endif
 
     mViewManagerFlushIsPending = false;
     RefPtr<nsViewManager> vm = mPresContext->GetPresShell()->GetViewManager();
     bool skipPaint = false;
 #if defined(MOZ_WIDGET_ANDROID)
     gfx::VRManager* vrm = gfx::VRManager::Get();
     skipPaint = vrm->IsPresenting();
-#endif // defined(MOZ_WIDGET_ANDROID)
+#endif  // defined(MOZ_WIDGET_ANDROID)
     if (!skipPaint) {
       PaintTelemetry::AutoRecordPaint record;
       vm->ProcessPendingUpdates();
     }
 
 #ifdef MOZ_DUMP_PAINTING
     if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
       printf_stderr("Ending ProcessPendingUpdates\n");