Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scheduler): getNow detection can randomly fail (fix #9632) #9667

Merged

Conversation

felixbuenemann
Copy link
Contributor

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).

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

This is a rebases version of PR #9647, since it was merged incomplete.

See the discussion in #9632 and #9647 for additional info.

This needs to be backported to the 2.6 branch.

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).
@yyx990803 yyx990803 merged commit ef2a380 into vuejs:dev Mar 11, 2019
@felixbuenemann felixbuenemann deleted the fix-getnow-detection-randomly-failing branch March 11, 2019 07:52
yyx990803 added a commit that referenced this pull request Mar 19, 2019
fix #9729

This reverts #9667, but also fixes the original issue #9632 by skipping
the check in IE altogether (since all IE use low-res event timestamps).
kiku-jw pushed a commit to kiku-jw/vue that referenced this pull request Jun 18, 2019
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).
kiku-jw pushed a commit to kiku-jw/vue that referenced this pull request Jun 18, 2019
fix vuejs#9729

This reverts vuejs#9667, but also fixes the original issue vuejs#9632 by skipping
the check in IE altogether (since all IE use low-res event timestamps).
Lostlover pushed a commit to Lostlover/vue that referenced this pull request Dec 10, 2019
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).
Lostlover pushed a commit to Lostlover/vue that referenced this pull request Dec 10, 2019
fix vuejs#9729

This reverts vuejs#9667, but also fixes the original issue vuejs#9632 by skipping
the check in IE altogether (since all IE use low-res event timestamps).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants