mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
Disable JS_OBJECT bridge on pre-gingerbread devices.
It's the easiest way to avoid bugs with Java strings not being converted to JS Strings.
This commit is contained in:
parent
0eee2293dc
commit
aa2d17e489
@ -272,8 +272,14 @@ public class CordovaWebView extends WebView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void exposeJsInterface() {
|
private void exposeJsInterface() {
|
||||||
// addJavascriptInterface crashes on the 2.3 emulator.
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
|
||||||
if (Build.VERSION.RELEASE.startsWith("2.3") && Build.MANUFACTURER.equals("unknown")) {
|
Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
|
||||||
|
// Bug being that Java Strings do not get converted to JS strings automatically.
|
||||||
|
// This isn't hard to work-around on the JS side, but it's easier to just
|
||||||
|
// use the prompt bridge instead.
|
||||||
|
return;
|
||||||
|
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && Build.MANUFACTURER.equals("unknown")) {
|
||||||
|
// addJavascriptInterface crashes on the 2.3 emulator.
|
||||||
Log.i(TAG, "Disabled addJavascriptInterface() bridge callback due to a bug on the 2.3 emulator");
|
Log.i(TAG, "Disabled addJavascriptInterface() bridge callback due to a bug on the 2.3 emulator");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user