Skip to content

Conversation

richherrera
Copy link
Contributor

@richherrera richherrera commented Mar 20, 2025

Summary of changes

  • Remove all script handlers in deinit to avoid retain cycles in WebAuthenticationSession.
  • Instead of POPPopupBridge handling WKWebView messages directly, WebViewScriptHandler now acts as an intermediary.
  • WebViewScriptHandler receives messages from WKWebView and forwards them to proxy.
  • The proxy property in WebViewScriptHandler is weak, helping prevent potential retain cycles.
  • Add Unit Test

🐛

bug.mov

🧼

retain-cycles.mov

Checklist

  • [ ] Added a changelog entry

Authors

@richherrera richherrera self-assigned this Mar 20, 2025
@richherrera richherrera requested a review from a team as a code owner March 20, 2025 20:37
Copy link
Contributor

@jaxdesmarais jaxdesmarais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to add a unit test for this? Not sure if it's easily testable now that it's fixed but not a blocker.

@sarahkoop sarahkoop requested review from agedd and warmkesselj March 21, 2025 19:05
@richherrera
Copy link
Contributor Author

Are we able to add a unit test for this? Not sure if it's easily testable now that it's fixed but not a blocker.

Sure, I added a new method to check for memory leaks. What I did was add the test and the extension in v3, then did the same in this branch. It seems the tests were successful.

@richherrera richherrera merged commit c08da20 into v3 Mar 24, 2025
4 checks passed
@richherrera richherrera deleted the retain-cycles branch March 24, 2025 16:15
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.

3 participants