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

"history.replaceState" error on Mobile Safari #5612

Closed
lucaswoj opened this issue Nov 7, 2017 · 2 comments · Fixed by #5613
Closed

"history.replaceState" error on Mobile Safari #5612

lucaswoj opened this issue Nov 7, 2017 · 2 comments · Fixed by #5613

Comments

@lucaswoj
Copy link
Contributor

lucaswoj commented Nov 7, 2017

We're seeing a spike in occurrences of an error message on our embed page (i.e. https://api.mapbox.com/styles/v1/mapbox/outdoors-v9.html)

SecurityError: Attempt to use history.replaceState() more than 100 times per 30.000000 seconds

Research suggests this error message is new to iOS 9.3.

mapbox-gl-js version: v0.40.1

Steps to Trigger Behavior

Expected Behavior

No error messages

Actual Behavior

SecurityError: Attempt to use history.replaceState() more than 100 times per 30.000000 seconds
@anandthakker
Copy link
Contributor

I don't have a cord with me to plug in my phone and see the console, but I'm curious: do you have to move the map very frequently to reproduce this? 100 times per 30 seconds, being > 3 times per second, seems abnormally frequent for moveend events.

@lucaswoj
Copy link
Contributor Author

lucaswoj commented Nov 8, 2017

@anandthakker 👉 #5613 (comment)

lucaswoj added a commit that referenced this issue Nov 15, 2017
…error message (#5613)

* Throttle calls to "window.history.replaceState" to fix Mobile Safari error message

fixes #5612

* Fix unit tests

* Use custom throttle function

* Appease the linter gods

* Revert changes to debug/index.html

* Revert changes to util.js

* Switch to function declarations

* Use @mourner's throttle implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants