diff options
author | Grace Kloba <klobag@google.com> | 2009-08-11 11:47:24 -0700 |
---|---|---|
committer | Grace Kloba <klobag@google.com> | 2009-08-11 11:47:24 -0700 |
commit | 758bf410843724d31f4ab48e8d7dd6b7c1240f23 (patch) | |
tree | 9a2dfd5106cb564d57290c4bf71d8fd236236c1e /core/java/android/webkit/FrameLoader.java | |
parent | 03a97462003a1df679144edeee921112d8925133 (diff) | |
download | frameworks_base-758bf410843724d31f4ab48e8d7dd6b7c1240f23.zip frameworks_base-758bf410843724d31f4ab48e8d7dd6b7c1240f23.tar.gz frameworks_base-758bf410843724d31f4ab48e8d7dd6b7c1240f23.tar.bz2 |
Improve Browser performance by 1-2%. To address domain sanity bug,
http://b/issue?id=1022797, we decoded/encoded the url for each request. As
the url can be long, getBytes() and String.init are taking 1.5% in nytimes.com
and 2.4% in cnn.com. By doing a simple URL encoding test, we can shave 1-2
secs thread time during loading.
Diffstat (limited to 'core/java/android/webkit/FrameLoader.java')
-rw-r--r-- | core/java/android/webkit/FrameLoader.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java index 8298729..e7978ac 100644 --- a/core/java/android/webkit/FrameLoader.java +++ b/core/java/android/webkit/FrameLoader.java @@ -95,17 +95,6 @@ class FrameLoader { public boolean executeLoad() { String url = mListener.url(); - // Attempt to decode the percent-encoded url. - try { - url = new String(URLUtil.decode(url.getBytes())); - } catch (IllegalArgumentException e) { - // Fail with a bad url error if the decode fails. - mListener.error(EventHandler.ERROR_BAD_URL, - mListener.getContext().getString( - com.android.internal.R.string.httpErrorBadUrl)); - return false; - } - if (URLUtil.isNetworkUrl(url)){ if (mSettings.getBlockNetworkLoads()) { mListener.error(EventHandler.ERROR_BAD_URL, @@ -113,6 +102,13 @@ class FrameLoader { com.android.internal.R.string.httpErrorBadUrl)); return false; } + // Make sure it is correctly URL encoded before sending the request + if (!URLUtil.verifyURLEncoding(url)) { + mListener.error(EventHandler.ERROR_BAD_URL, + mListener.getContext().getString( + com.android.internal.R.string.httpErrorBadUrl)); + return false; + } mNetwork = Network.getInstance(mListener.getContext()); return handleHTTPLoad(); } else if (handleLocalFile(url, mListener, mSettings)) { |