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

fix(ios): Reset plugin listeners when WebView process is terminated #7905

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gabeschine
Copy link

@gabeschine gabeschine commented Mar 5, 2025

Fixes #7810

This fixes an issue where, after the native WebView process is terminated, some messages from Native -> JS fail to be delivered to the JS side. In our production app, the important messages were appUrlOpen from the @capacitor/app plugin, and pushNotificationReceived from @capacitor/push-notifications.

The issue seems to have been present because the Capacitor plugins held onto stale listener registrations - with no counterpart in JS after a WebView kill - which made them send messages immediately (despite retainUntilConsumed being set to true) instead of waiting for a first listener.

Testing

Test runs from above test suite

NOTE: ! denotes an inconclusive run

Before:

FF!FF!!FF!

After:

!!........

@gabeschine gabeschine marked this pull request as ready for review March 5, 2025 19:37
@markemer markemer changed the title [ios] Reset plugin listeners when WebView process is terminated fix(ios): Reset plugin listeners when WebView process is terminated Mar 6, 2025
@markemer
Copy link
Member

markemer commented Mar 6, 2025

This is a nice find.

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.

[Bug]: [ios] Some Native -> JS messages appear to drop after extended time with app in background
3 participants