CB-4788: Modified the onJsPrompt to warn against Cordova calls

This commit is contained in:
Joe Bowser 2013-09-24 14:33:44 -07:00 committed by Anis Kadri
parent 1ce5dca61a
commit de4fd41f8e

View File

@ -95,7 +95,8 @@ public class InAppChromeClient extends WebChromeClient {
@Override
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
// See if the prompt string uses the 'gap-iab' protocol. If so, the remainder should be the id of a callback to execute.
if (defaultValue != null && defaultValue.startsWith("gap-iab://")) {
if (defaultValue != null && defaultValue.startsWith("gap")) {
if(defaultValue.startsWith("gap-iab://")) {
PluginResult scriptResult;
String scriptCallbackId = defaultValue.substring(10);
if (scriptCallbackId.startsWith("InAppBrowser")) {
@ -113,6 +114,14 @@ public class InAppChromeClient extends WebChromeClient {
return true;
}
}
else
{
// Anything else with a gap: prefix should get this message
LOG.w(LOG_TAG, "InAppBrowser does not support Cordova API calls: " + url + " " + defaultValue);
result.cancel();
return true;
}
}
return false;
}