You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2013/06/15 00:29:57 UTC
[1/2] android commit: CB-3504: Fixing issue with the use of
WebResourceResponse on pre-Honeycomb devices.
Updated Branches:
refs/heads/master 32d74f862 -> b679672c0
CB-3504: Fixing issue with the use of WebResourceResponse on pre-Honeycomb devices.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/90f83db9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/90f83db9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/90f83db9
Branch: refs/heads/master
Commit: 90f83db9c9de2dffb3a4db965d7221e83b0e917e
Parents: add1075
Author: Joe Bowser <bo...@apache.org>
Authored: Fri Jun 14 15:29:30 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Fri Jun 14 15:29:30 2013 -0700
----------------------------------------------------------------------
.../apache/cordova/CordovaWebViewClient.java | 28 --------------------
.../cordova/IceCreamCordovaWebViewClient.java | 19 ++++++++++++-
2 files changed, 18 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/90f83db9/framework/src/org/apache/cordova/CordovaWebViewClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java
index 4b00615..eef961c 100755
--- a/framework/src/org/apache/cordova/CordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java
@@ -211,35 +211,7 @@ public class CordovaWebViewClient extends WebViewClient {
}
return true;
}
-
- /**
- * Check for intercepting any requests for resources.
- * This includes images and scripts and so on, not just top-level pages.
- * @param view The WebView.
- * @param url The URL to be loaded.
- * @return Either null to proceed as normal, or a WebResourceResponse.
- */
- @Override
- public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
- //If something isn't whitelisted, just send a blank response
- if(!Config.isUrlWhiteListed(url) && (url.startsWith("http://") || url.startsWith("https://")))
- {
- return getWhitelistResponse();
- }
- if (this.appView.pluginManager != null) {
- return this.appView.pluginManager.shouldInterceptRequest(url);
- }
- return null;
- }
- private WebResourceResponse getWhitelistResponse()
- {
- WebResourceResponse emptyResponse;
- String empty = "";
- ByteArrayInputStream data = new ByteArrayInputStream(empty.getBytes());
- return new WebResourceResponse("text/plain", "UTF-8", data);
- }
-
/**
* On received http auth request.
* The method reacts on all registered authentication tokens. There is one and only one authentication token for any host + realm combination
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/90f83db9/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java b/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
index 847972e..259f20b 100644
--- a/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
@@ -18,6 +18,7 @@
*/
package org.apache.cordova;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -45,11 +46,27 @@ public class IceCreamCordovaWebViewClient extends CordovaWebViewClient {
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
//Check if plugins intercept the request
WebResourceResponse ret = super.shouldInterceptRequest(view, url);
- if(ret == null && (url.contains("?") || url.contains("#") || needsIceCreamSpaceInAssetUrlFix(url))){
+
+ if(!Config.isUrlWhiteListed(url) && (url.startsWith("http://") || url.startsWith("https://")))
+ {
+ ret = getWhitelistResponse();
+ }
+ else if(ret == null && (url.contains("?") || url.contains("#") || needsIceCreamSpaceInAssetUrlFix(url))){
ret = generateWebResourceResponse(url);
}
+ else if (ret == null && this.appView.pluginManager != null) {
+ ret = this.appView.pluginManager.shouldInterceptRequest(url);
+ }
return ret;
}
+
+ private WebResourceResponse getWhitelistResponse()
+ {
+ WebResourceResponse emptyResponse;
+ String empty = "";
+ ByteArrayInputStream data = new ByteArrayInputStream(empty.getBytes());
+ return new WebResourceResponse("text/plain", "UTF-8", data);
+ }
private WebResourceResponse generateWebResourceResponse(String url) {
if (url.startsWith("file:///android_asset/")) {
[2/2] android commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/cordova-android
Posted by bo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-android
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/b679672c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/b679672c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/b679672c
Branch: refs/heads/master
Commit: b679672c0e35cede2e49b7978ea5dec4fa27a158
Parents: 90f83db 32d74f8
Author: Joe Bowser <bo...@apache.org>
Authored: Fri Jun 14 15:29:51 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Fri Jun 14 15:29:51 2013 -0700
----------------------------------------------------------------------
bin/create | 1 -
bin/templates/cordova/run | 18 +++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------