-
Notifications
You must be signed in to change notification settings - Fork 237
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
Page crash iOS Safari in Private mode: infinite loop SessionStorage read warning #144
Comments
I also have the issue for my web site. For Safari in private browsing the browser hands out the window.localStorage objet but throws an exception when using the SetItem member. The problem is in Util.ts. The _getStorageObject and _getSessionStorageObject functions return the storage object but when the write functions use the storage object it throws an exception causing the write functions to return false. This causes the caller loop. The _getStorage*Object functions should use a pattern where they validate the storage object by performing a test write operation before handing out the object. This is a common pattern - e.g. see https://mathiasbynens.be/notes/localstorage-pattern. |
Private browsing in iOS Safari does provide a sessionStorage object, but throws an error when getting or setting an item. By getting the empty string key, it would cause an error to throw, which is caught by the existing try/catch that detects whether session storage is available. Fixes microsoft#144
Hope the AI team can review the PR which should fix this issue. I can't run the unit tests locally, the PS script opens an HTML page with empty unit tests. I can test the results via Browserstack. |
@tsj0603 thanks for explaining that. While you were typing that out, I was making the PR, teamwork! 😄 |
As confirmed in PR #146, the issue has been fixed and CDN has been updated. Again, thanks a lot for the quick fix, @AlexBulankou. 😄 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
As of a few weeks ago, user reported issue with iOS Safari in Private mode. Normal mode works fine.
When loading the page with the AI script, the browser reports eventually in a message bar:
A problem occured with this webpage so it was reloaded.
and the page content has only the message:
A problem repeatedly occurred on "<URL>".
.Reproduced with Browserstack real browser on various devices and on my own iPhone.
The console log has repeatedly this message (up to 6400 times):
ai.0.js:1 AI (Internal): NONUSRACT_BrowserCannotWriteSessionStorage message:"Browser failed write to session storage. " props:"{exception:[object DOMException]{\code\:22,\name\:\QuotaExceededError\,\message\:\QuotaExceededError: DOM Exception 22\,\line\:1,\column\:16686,\sourceURL\:\https://az416426.vo.msecnd.net/scripts/a/ai.0.js\}}"
When Safari is in Private mode it doesn't allow to read session storage.
The AI code has a try/catch around that, but somehow the attempt is repeated.
The text was updated successfully, but these errors were encountered: