Updated Branches: refs/heads/master a429d52bd -> 10788b94d
[CB-2666] Added exec retries for null arguments. When Java sends back a message saying that null arguments were received, we try to send them again with a different bridge mode. Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/10788b94 Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/10788b94 Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/10788b94 Branch: refs/heads/master Commit: 10788b94dbe91bd999d705ecab58f3a8fe7a9145 Parents: a429d52 Author: Max Woghiren <[email protected]> Authored: Wed Mar 27 11:49:26 2013 -0400 Committer: Max Woghiren <[email protected]> Committed: Thu Apr 4 11:51:23 2013 -0400 ---------------------------------------------------------------------- lib/android/exec.js | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-js/blob/10788b94/lib/android/exec.js ---------------------------------------------------------------------- diff --git a/lib/android/exec.js b/lib/android/exec.js index af2715b..be58dff 100644 --- a/lib/android/exec.js +++ b/lib/android/exec.js @@ -95,7 +95,16 @@ function androidExec(success, fail, service, action, args) { window.location = 'http://cdv_exec/' + service + '#' + action + '#' + callbackId + '#' + argsJson; } else { var messages = nativeApiProvider.get().exec(service, action, callbackId, argsJson); - androidExec.processMessages(messages); + // If argsJson was received by Java as null, try again with the PROMPT bridge mode. + // This happens in rare circumstances, such as when certain Unicode characters are passed over the bridge on a Galaxy S2. See CB-2666. + if (jsToNativeBridgeMode == jsToNativeModes.JS_OBJECT && messages === "@Null arguments.") { + androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT); + androidExec(success, fail, service, action, args); + androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT); + return; + } else { + androidExec.processMessages(messages); + } } if (cordova.callbacks[callbackId]) { if (success || fail) {
