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

Prevent ASWebAuthenticationSession crash when browser reloads due to cookies being cleared #904

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Feb 25, 2025

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

This PR adds a workaround for the crash reported in #902. The crash is caused by a double-release problem deep inside ASWebAthenticationSession, which happens sometimes when the browser reloads due to the cookies being cleared mid-way through.

Image Image

The workaround amounts to holding a strong reference to the ASWebAuthenticationSession instance, as described in http://ww.openradar.appspot.com/FB12132525. To prevent memory leaks in certain circumstances due to multiple held instances, only one ASWebAuthenticationSession session can be held in memory at a time.

📎 References

🎯 Testing

Unit tests were added, and the change was manually tested with an iPhone 14 Pro Max running iOS 18.2.1, using Xcode 16.2 (16C5032a).

@Widcket Widcket requested a review from a team as a code owner February 25, 2025 13:47
@Widcket Widcket force-pushed the fix/cookies-reload-crash branch from 40e1611 to 5549a5b Compare February 25, 2025 14:26
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.

Intermittent crash when cancelling an authentication session
1 participant