zulip / zulip-mobile

Zulip mobile apps for Android and iOS.
https://zulip.com/apps/
Apache License 2.0
1.27k stars 640 forks source link

iOS simulator crash on rapid keyboard input in search screen #3622

Open rk-for-zulip opened 4 years ago

rk-for-zulip commented 4 years ago

Steps to reproduce:

  1. Open the app in the iOS simulator, connected to a dev server. Log in if needed.
  2. Tap the magnifying glass in the upper right.
  3. Smash the physical keyboard.

After a moment, the app will crash with the message Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string., with an associated callstack containing only library code.

Could not replicate on the Android emulator. Could not replicate while connected to chat.zulip.org (rather than a dev server). Tests not yet performed with real hardware.

rk-for-zulip commented 4 years ago

(Accidentally submitted very prematurely due to fumblefingers. Apologies.)

gnprice commented 4 years ago

Interesting!

The "injectedJavaScript" suggests a connection with how we communicate with the JS inside the webview - it's how the postMessage method is implemented. I think it probably has to mean a bug in the implementation of postMessage.

That's separately implemented for iOS and Android, so the bug is probably iOS-only.

On Thu, Sep 19, 2019, 13:52 Ray Kraesig notifications@github.com wrote:

Reopened #3622 https://github.com/zulip/zulip-mobile/issues/3622.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zulip/zulip-mobile/issues/3622?email_source=notifications&email_token=AAAG4DJLQF4RSUFNNWQR6J3QKPRAPA5CNFSM4IYP2NP2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOTXNRJAI#event-2648380545, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAG4DMJ3TGGOHSNTWLWRMDQKPRAPANCNFSM4IYP2NPQ .

chrisbobbe commented 4 years ago

Hmm. I just ran into this error today while working on https://github.com/zulip/zulip-mobile/pull/3832, except I wasn't typing in the search box, I was typing in the compose box.

It only happened once, and I haven't been able to reproduce it again. It seemed as though (maybe?) clicking the back button shortly after I finished smashing the keyboard might have triggered it, but again it's only happened this once. It was on chat.zulip.org, which Ray says he tried but wasn't able to reproduce it on.

I was using the iOS simulator (simulating iPhone 11, iOs 13.3).

I noticed that the WebView does not use the "injectJavaScript" or the "injectedJavaScript" props; it seems like the error message refers to the latter prop.

gnprice commented 4 years ago

I noticed that the WebView does not use the "injectJavaScript" or the "injectedJavaScript" props; it seems like the error message refers to the latter prop.

Yeah, this isn't a name we refer to directly in our code, but it appears in the implementation of WebView, and specifically in the implementation of the postMessage method, which we do use.

Here's the source code for that error message, in fact:

$ rg injectedJavaScript node_modules/
[...]
node_modules/react-native-webview/ios/RNCWKWebView.m
798:      RCTLogError(@"Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string.");

Some related discussion in #3572. I guess in particular my comment above:

I think it probably has to mean a bug in the implementation of postMessage.

would mean that fixing #3572 would also fix this issue.