From 091a58cf3677b50364132a53d372c99215211425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20B=C3=BCnemann?= Date: Mon, 11 Mar 2019 03:28:06 +0100 Subject: [PATCH] fix(scheduler): getNow detection can randomly fail (#9667) The previous detection code compared time stamps based on Date.now() which are not monotonic, so the check could fail due to clock skew or adjustments. This fix changes the check to compare against performance.now() if it is supported, because it is monotonic (strictly increasing). --- src/core/observer/scheduler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/observer/scheduler.js b/src/core/observer/scheduler.js index 1463fc64ad3..b0583ed12bd 100644 --- a/src/core/observer/scheduler.js +++ b/src/core/observer/scheduler.js @@ -51,7 +51,7 @@ if ( inBrowser && window.performance && typeof performance.now === 'function' && - getNow() > document.createEvent('Event').timeStamp + document.createEvent('Event').timeStamp <= performance.now() ) { // if the event timestamp is bigger than the hi-res timestamp // (which is evaluated AFTER) it means the event is using a lo-res timestamp,