From 2c18ede18edf6539c42d9406943576f0251f7059 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 16 Dec 2011 18:08:30 +0000 Subject: [PATCH] Do not allow file:// access when it is disabled. If WebSettings is configured to disallow access to file:// URLs, then block them. Bug: 5773763 Change-Id: If2793f31cb37e0d3af15cb18e818bfa4058167fd --- core/java/android/webkit/BrowserFrame.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java index 0da867f0fb806..8ce12fc6049b7 100644 --- a/core/java/android/webkit/BrowserFrame.java +++ b/core/java/android/webkit/BrowserFrame.java @@ -942,6 +942,13 @@ class BrowserFrame extends Handler { if (androidResource != null) { return new WebResourceResponse(null, null, androidResource); } + + // Note that we check this after looking for an android_asset or + // android_res URL, as we allow those even if file access is disabled. + if (!mSettings.getAllowFileAccess() && url.startsWith("file://")) { + return new WebResourceResponse(null, null, null); + } + WebResourceResponse response = mCallbackProxy.shouldInterceptRequest(url); if (response == null && "browser:incognito".equals(url)) { try {