wordpress-mobile / WordPress-Editor-Android

⛔️ [DEPRECATED] A reusable Android rich text editor component.
GNU General Public License v2.0
188 stars 50 forks source link

Issue #432: evaluateJavaScript not supported #435

Closed aforcier closed 8 years ago

aforcier commented 8 years ago

Fixes #432. The issue occurs in custom ROMs using the 4.3 'classic' WebView (pre-Chromium) in a Android 4.4 build. Fixed by reverting to the 'compatibility' WebView in those cases, which uses the older loadUrl method for executing JavaScript (as well as applying our reflection-based modifications to avoid the keyboard being dismissed on JS execution).

cc @maxme

aforcier commented 8 years ago

Note: The crash can be simulated by using EditorWebView instead of EditorWebViewCompatibility here.

However, doing this on a 4.3 emulator will result in a NoSuchMethodError rather than an IllegalStateException. The custom ROMs are using a pre-release KitKat snapshot (as far as I can tell), which actually implemented evaluteJavascript but it's a stub that throws the IllegalStateException we're seeing in the crash log.

I opted to catch both errors just in case.

maxme commented 8 years ago

:shipit: