diff options
author | Paul Miller <paulmiller@google.com> | 2015-03-31 14:16:21 -0700 |
---|---|---|
committer | Paul Miller <paulmiller@google.com> | 2015-04-02 12:32:11 -0700 |
commit | ca7ecd85ac925ef44dbef327310f2baad13322f2 (patch) | |
tree | 166891947d1dd201864c238528c3a9b73739f687 /src/com/android/browser/Tab.java | |
parent | 0de964c432318947188f61a7b80963c70a787d9b (diff) | |
download | packages_apps_Browser-ca7ecd85ac925ef44dbef327310f2baad13322f2.zip packages_apps_Browser-ca7ecd85ac925ef44dbef327310f2baad13322f2.tar.gz packages_apps_Browser-ca7ecd85ac925ef44dbef327310f2baad13322f2.tar.bz2 |
Restrict "javascript" and "file" scheme intents
"javascript" is not allowed; "file" is only allowed in certain directories
BUG:19296779
BUG:13082135
Change-Id: I389a5b0ad3e8add1b1159faca3212c7f11f3ae69
Diffstat (limited to 'src/com/android/browser/Tab.java')
-rw-r--r-- | src/com/android/browser/Tab.java | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index dc1944e..a4d2ce0 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -74,9 +74,7 @@ import com.android.browser.TabControl.OnThumbnailUpdatedListener; import com.android.browser.homepages.HomeProvider; import com.android.browser.provider.SnapshotProvider.Snapshots; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; @@ -105,8 +103,6 @@ class Tab implements PictureListener { private static final int CAPTURE_DELAY = 100; private static final int INITIAL_PROGRESS = 5; - private static final String RESTRICTED = "<html><body>not allowed</body></html>"; - private static Bitmap sDefaultFavicon; private static Paint sAlphaPaint = new Paint(); @@ -609,27 +605,7 @@ class Tab implements PictureListener { @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { - Uri uri = Uri.parse(url); - if (uri.getScheme().toLowerCase().equals("file")) { - File file = new File(uri.getPath()); - try { - if (file.getCanonicalPath().startsWith( - mContext.getApplicationContext().getApplicationInfo().dataDir)) { - return new WebResourceResponse("text/html","UTF-8", - new ByteArrayInputStream(RESTRICTED.getBytes("UTF-8"))); - } - } catch (Exception ex) { - Log.e(LOGTAG, "Bad canonical path" + ex.toString()); - try { - return new WebResourceResponse("text/html","UTF-8", - new ByteArrayInputStream(RESTRICTED.getBytes("UTF-8"))); - } catch (java.io.UnsupportedEncodingException e) { - } - } - } - WebResourceResponse res = HomeProvider.shouldInterceptRequest( - mContext, url); - return res; + return HomeProvider.shouldInterceptRequest(mContext, url); } @Override |