-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SecurityError: Attempt to use history.replaceState() more than 100 times per 30 seconds #365
Comments
That's surprising. I would expect the |
@benmccann we have browserstack :) |
Does this also happen on macOS? I have access to multiple iPhones, iPads, and a Macbook I can use to test. There may also be a difference between iOS WebView vs iOS Safari. Possibly another real world case, although I'm not 100% on it yet: https://www.reddit.com/r/sveltejs/comments/lo2560/unofficial_documentation_for_sveltekit_made_using/go7wt6y/?context=3, seems like it may be causing hilariously low framerates when scrolling. I'm wondering if it's possible such that multiple scroll events trigger at the same time, such that a race condition occurs:
What if we push the timeouts into an array and call |
In case it's useful, I also see this on production, with Sentry - using Sapper, so we shouldn't be looking for something Kit specific. Looks like an issue from Sapper got carried over to the Svelte Kit codebase. I'll dump any useful info here when I look it up later today. |
I'm surprised you'd be seeing this in Sapper as well because this section of code was completely rewritten in Kit |
What if you changed it to only run every 500ms? Then it would only run a max of 60 times in 30 seconds. I feel like that is still pretty frequent for restoring the scroll position later. |
It should not be running when continuously moving the mouse or when not moving the mouse, but only when the mouse was moving and then stops. Changing it to 500s sounds like a copout instead of really understanding the issue as to why debouncing isn't working here. |
I see what you mean! |
Not entirely sure if it should go here or in a separate issue. Happy to move it to a separate issue if needed. I'm observing the same issue mentioned here but I also have some (iOS only) errors about
Might be related somehow. |
seeing these issues in production on iOS 14.7.1 devices (iPhone 12 mini - "iPhone13,1")
|
Can confirm I'm picking this up via Sentry too:
Mobile Safari iOS iPhone |
May be we can refer to this solution. https://github.com/ampproject/amphtml/pull/23938/files |
Check out my PR on this issue: #2738 |
I tested this on my iphone today and I discovered that ios emits the scroll event later than other browsers. Intervals between scroll events rapidly fluctuate between 30 - 150ms. And an easy way to aggressively trigger this bug is to quickly scroll up and down, that would consistently give 200-300ms. With these said, our debounce function runs at a 50ms interval, which explains how the security error was caused, because we essentially had no debouncing at all. I'll submit a PR to increase it to 200ms as that gives the least false positives. |
What is the fix for this issue. I am also getting the same error. can anyone please help? |
This is safari specific |
This is still happening on Safari and potentially iOS but it is specific to Safari. |
We've been seeing this in production, via Sentry — almost exclusively on iPhones. I assume it's related to this:
kit/packages/kit/src/runtime/internal/router/index.js
Lines 49 to 63 in ad9551c
The text was updated successfully, but these errors were encountered: