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

Infinite Loop Bug in beforeUnloadHandler() #12108

Closed
yossicohn opened this issue Sep 24, 2017 · 1 comment
Closed

Infinite Loop Bug in beforeUnloadHandler() #12108

yossicohn opened this issue Sep 24, 2017 · 1 comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. duplicate For issues that already existed in our issue tracker and were reported previously.
Milestone

Comments

@yossicohn
Copy link
Contributor

Problem
In Piwik.js The function beforeUnloadHandler() is entering a semi-infinite loop

Scenario
when the User changes the System Time to some time previous to the current (let's say an hour back in time).
Then the semi-infinite loop starts on the call to beforeUnloadHandler function:
This is due to the part of the code:
do {
now = new Date();
} while (now.getTimeAlias() < expireDateTime);

since the now is not near the expireDateTime, it would take lot's of loops to get to the expireDateTime, mean while the browser is stack.

@tsteur
Copy link
Member

tsteur commented Sep 24, 2017

Good point. I think we should limit set expireDateTime to max 3 seconds in the beginning of that function to prevent such cases and possibly other issues. Do you mind maybe creating a PR?

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Sep 24, 2017
@tsteur tsteur added this to the 3.2.0 milestone Sep 24, 2017
@mattab mattab removed this from the 3.3.0 milestone Oct 6, 2017
@mattab mattab added this to the 4.0.0 milestone Sep 4, 2020
@tsteur tsteur closed this as completed Sep 14, 2020
@mattab mattab added the duplicate For issues that already existed in our issue tracker and were reported previously. label Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. duplicate For issues that already existed in our issue tracker and were reported previously.
Projects
None yet
Development

No branches or pull requests

3 participants