From 9ac4b570e66f5c2cafa68212fac5835a17bd47af Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Fri, 14 Jun 2013 16:55:47 -0700 Subject: [PATCH] CB-2391: Fix for colons crashing the WebView on ICS, tested on Samsung Galaxy S2 --- .../cordova/IceCreamCordovaWebViewClient.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java b/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java index 259f20b5..c4fdbf4e 100644 --- a/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java +++ b/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java @@ -51,7 +51,7 @@ public class IceCreamCordovaWebViewClient extends CordovaWebViewClient { { ret = getWhitelistResponse(); } - else if(ret == null && (url.contains("?") || url.contains("#") || needsIceCreamSpaceInAssetUrlFix(url))){ + else if(ret == null && (url.contains("?") || url.contains("#") || needsIceCreamSpecialsInAssetUrlFix(url))){ ret = generateWebResourceResponse(url); } else if (ret == null && this.appView.pluginManager != null) { @@ -82,12 +82,18 @@ public class IceCreamCordovaWebViewClient extends CordovaWebViewClient { } return null; } - - private static boolean needsIceCreamSpaceInAssetUrlFix(String url) { + + private static boolean needsIceCreamSpecialsInAssetUrlFix(String url) { + // Encoded Spaces if (!url.contains("%20")){ return false; } - + + // colons + if(url.split(":").length <= 2) { + return false; + } + switch(android.os.Build.VERSION.SDK_INT){ case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH: case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1: