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: Fix JavaScript handlers in InAppBrowser for Android #2428

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

Conversation

fuzzybinary
Copy link

Android InAppBrowserActivity would not call prepareAndAddUserScripts when WebViewFeature.DOCUMENT_START_SCRIPT, which would prevent shims like callHandler from being injected.

Fix this by calling prepareAndAddUserScripts during OnCreate.

Other injections were likely also broken but this is the one I needed.

I also added an integration test for JavaScript handlers in in_app_browser. This test fails without this change on Android emulators 33+.

Connection with issue(s)

Resolve issue #1973

Testing and Review Notes

So far as I can tell, we do not need to wrap prepareAndAddUserScripts to check if WebViewFeature.DOCUMENT_START_SCRIPT is supported to prevent a double call, as addPluginScript does this already.

Android InAppBrowserActivity would not call `prepareAndAddUserScripts` when `WebViewFeature.DOCUMENT_START_SCRIPT`, which would prevent shims like `callHandler` from being injected.

Fix this by calling `prepareAndAddUserScripts` during OnCreate.

Add an integration test for JavaScript handlers in in_app_browser.

refs: pichillilorenzo#1973
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.

1 participant