From f147b5f2a61ab0842adaa430d9a8bbe98a83e4a4 Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Mon, 23 May 2011 14:25:27 +0100 Subject: [PATCH] Fix for bug 4144936: [Proxy setting]: traffic to a bypass domain doesn't bypass proxy DO NOT MERGE This is the WebView part, passing the bypass list to the native side. Moved some code to JWebCoreJavaBridge.java because because sendStaticMessage only takes one argument. Needs CL in external/webkit: https://android-git.corp.google.com/g/#change,111108 Needs following CL in external/chromium: https://android-git.corp.google.com/g/#change,111107 Change-Id: Ib548bdcbc9eb22bbb8f2754808840052bd3ec80e --- core/java/android/webkit/JWebCoreJavaBridge.java | 17 ++++++++++++++++- core/java/android/webkit/WebView.java | 14 ++------------ core/java/android/webkit/WebViewCore.java | 3 ++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/core/java/android/webkit/JWebCoreJavaBridge.java b/core/java/android/webkit/JWebCoreJavaBridge.java index 976e7868c119..053d3c8dc0fb 100644 --- a/core/java/android/webkit/JWebCoreJavaBridge.java +++ b/core/java/android/webkit/JWebCoreJavaBridge.java @@ -16,6 +16,7 @@ package android.webkit; +import android.net.ProxyProperties; import android.net.Uri; import android.os.Handler; import android.os.Message; @@ -297,6 +298,20 @@ final class JWebCoreJavaBridge extends Handler { mContentUriToFilePathMap.put(contentUri, path); } + public void updateProxy(ProxyProperties proxyProperties) { + if (proxyProperties == null) { + nativeUpdateProxy("", ""); + return; + } + + String host = proxyProperties.getHost(); + int port = proxyProperties.getPort(); + if (port != 0) + host += ":" + port; + + nativeUpdateProxy(host, proxyProperties.getExclusionList()); + } + private native void nativeConstructor(); private native void nativeFinalize(); private native void sharedTimerFired(); @@ -307,5 +322,5 @@ final class JWebCoreJavaBridge extends Handler { public native void addPackageNames(Set packageNames); public native void addPackageName(String packageName); public native void removePackageName(String packageName); - public native void updateProxy(String newProxy); + public native void nativeUpdateProxy(String newProxy, String exclusionList); } diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index cf83456f9dee..0d34ff66fc5b 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1045,20 +1045,10 @@ public class WebView extends AbsoluteLayout private static void handleProxyBroadcast(Intent intent) { ProxyProperties proxyProperties = (ProxyProperties)intent.getExtra(Proxy.EXTRA_PROXY_INFO); if (proxyProperties == null || proxyProperties.getHost() == null) { - WebViewCore.sendStaticMessage(EventHub.PROXY_CHANGED, ""); + WebViewCore.sendStaticMessage(EventHub.PROXY_CHANGED, null); return; } - - String host = proxyProperties.getHost(); - int port = proxyProperties.getPort(); - if (port != 0) - host += ":" + port; - - // TODO: Handle exclusion list - // The plan is to make an AndroidProxyResolver, and handle the blacklist - // there - String exclusionList = proxyProperties.getExclusionList(); - WebViewCore.sendStaticMessage(EventHub.PROXY_CHANGED, host); + WebViewCore.sendStaticMessage(EventHub.PROXY_CHANGED, proxyProperties); } /* diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 027169597921..5d535547d5b7 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -24,6 +24,7 @@ import android.graphics.Point; import android.graphics.Rect; import android.graphics.Region; import android.media.MediaFile; +import android.net.ProxyProperties; import android.net.Uri; import android.os.Handler; import android.os.Looper; @@ -705,7 +706,7 @@ final class WebViewCore { throw new IllegalStateException( "No WebView has been created in this process!"); } - BrowserFrame.sJavaBridge.updateProxy((String) msg.obj); + BrowserFrame.sJavaBridge.updateProxy((ProxyProperties)msg.obj); break; } } -- 2.11.0