diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 5eb93857f7ed4..3be4af0441034 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1990,13 +1990,9 @@ public class WebView extends AbsoluteLayout * that is loaded through this interface. As such, it is used to resolve any * relative URLs. The historyUrl is used for the history entry. *
- * Note for post 1.0. Due to the change in the WebKit, the access to asset - * files through "file:///android_asset/" for the sub resources is more - * restricted. If you provide null or empty string as baseUrl, you won't be - * able to access asset files. If the baseUrl is anything other than - * http(s)/ftp(s)/about/javascript as scheme, you can access asset files for - * sub resources. - * + * Note that content specified in this way can access local device files + * (via 'file' scheme URLs) only if baseUrl specifies a scheme other than + * 'http', 'https', 'ftp', 'ftps', 'about' or 'javascript'. * @param baseUrl Url to resolve relative paths with, if null defaults to * "about:blank" * @param data A String of data in the given encoding. diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 16e457103fa60..95ce2a207a345 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -1141,16 +1141,13 @@ public final class WebViewCore { if (baseUrl != null) { int i = baseUrl.indexOf(':'); if (i > 0) { - /* - * In 1.0, {@link - * WebView#loadDataWithBaseURL} can access - * local asset files as long as the data is - * valid. In the new WebKit, the restriction - * is tightened. To be compatible with 1.0, - * we automatically add the scheme of the - * baseUrl for local access as long as it is - * not http(s)/ftp(s)/about/javascript - */ + // In 1.0, WebView.loadDataWithBaseURL() could access local + // asset files using 'file' scheme URLs as long as the data is + // valid. Later versions of WebKit have tightened the + // restriction around when pages can access such local URLs. + // To maintain compatibility with 1.0, we register the scheme of + // the baseUrl to be considered local, as long as it is not + // http(s)/ftp(s)/about/javascript. String scheme = baseUrl.substring(0, i); if (!scheme.startsWith("http") && !scheme.startsWith("ftp") &&