From 67352079366c3b449a6250d26de2e1e9bf252960 Mon Sep 17 00:00:00 2001
From: purplecabbage <purplecabbage@gmail.com>
Date: Tue, 24 Sep 2013 01:50:54 -0700
Subject: [PATCH 1/2] [windows8] commandProxy was moved

---
 www/windows8/InAppBrowserProxy.js | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/www/windows8/InAppBrowserProxy.js b/www/windows8/InAppBrowserProxy.js
index 9928d19..b14dd2b 100644
--- a/www/windows8/InAppBrowserProxy.js
+++ b/www/windows8/InAppBrowserProxy.js
@@ -19,7 +19,7 @@ cordova.define("org.apache.cordova.core.inappbrowser.InAppBrowserProxy", functio
  *
 */
 
-/*global Windows:true */  
+/*global Windows:true */
 
 
 
@@ -89,13 +89,8 @@ var IAB = {
             window.location = strUrl;
         }
 
-
-
-        
-
         //var object = new WinJS.UI.HtmlControl(elem, { uri: strUrl });
 
-
     },
 
     injectScriptCode:function(code, bCB) {
@@ -108,10 +103,7 @@ var IAB = {
     }
 };
 
-
-
-
 module.exports = IAB;
 
 
-require("cordova/commandProxy").add("InAppBrowser",IAB);});
+require("cordova/windows8/commandProxy").add("InAppBrowser",module.exports);

From 2dcfafb60e2ba51678d6fdd4305e5d82bbfaa22f Mon Sep 17 00:00:00 2001
From: Joe Bowser <bowserj@apache.org>
Date: Tue, 24 Sep 2013 14:33:44 -0700
Subject: [PATCH 2/2] CB-4788: Modified the onJsPrompt to warn against Cordova
 calls

---
 src/android/InAppChromeClient.java | 35 +++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/android/InAppChromeClient.java b/src/android/InAppChromeClient.java
index 2db73ab..2c240c6 100644
--- a/src/android/InAppChromeClient.java
+++ b/src/android/InAppChromeClient.java
@@ -95,21 +95,30 @@ 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://")) {
-            PluginResult scriptResult;
-            String scriptCallbackId = defaultValue.substring(10);
-            if (scriptCallbackId.startsWith("InAppBrowser")) {
-                if(message == null || message.length() == 0) {
-                    scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray());
-                } else {
-                    try {
-                        scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray(message));
-                    } catch(JSONException e) {
-                        scriptResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
+        if (defaultValue != null && defaultValue.startsWith("gap")) {
+            if(defaultValue.startsWith("gap-iab://")) {
+                PluginResult scriptResult;
+                String scriptCallbackId = defaultValue.substring(10);
+                if (scriptCallbackId.startsWith("InAppBrowser")) {
+                    if(message == null || message.length() == 0) {
+                        scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray());
+                    } else {
+                        try {
+                            scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray(message));
+                        } catch(JSONException e) {
+                            scriptResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
+                        }
                     }
+                    this.webView.sendPluginResult(scriptResult, scriptCallbackId);
+                    result.confirm("");
+                    return true;
                 }
-                this.webView.sendPluginResult(scriptResult, scriptCallbackId);
-                result.confirm("");
+            }
+            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;
             }
         }