diff options
author | Steve Block <steveblock@google.com> | 2011-12-15 15:16:19 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-12-15 17:46:21 +0000 |
commit | 92f30c3d5f39bd33dcab8c3d31e156ea3188a67a (patch) | |
tree | 1b9e49c5af42d1470984e1b38aa41e56cbc54567 /core/java/android/webkit | |
parent | 926d55eb40b9042c200f154fdf0c7c7969e0e359 (diff) | |
download | frameworks_base-92f30c3d5f39bd33dcab8c3d31e156ea3188a67a.zip frameworks_base-92f30c3d5f39bd33dcab8c3d31e156ea3188a67a.tar.gz frameworks_base-92f30c3d5f39bd33dcab8c3d31e156ea3188a67a.tar.bz2 |
Fix AppCache when either no path or an invalid path is supplied
The bulk of the change is in to external/webkit:
https://android-git.corp.google.com/g/155448
This part of the change simply adds some optimizations to avoid syncing to
native when not required, and cleans up the JavaDoc.
Bug: 5745181
Change-Id: I0009c1868755fe211ec2dc31bd007d393aabfbe3
Diffstat (limited to 'core/java/android/webkit')
-rw-r--r-- | core/java/android/webkit/WebSettings.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index f947f95..b2d8db0 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -201,7 +201,7 @@ public class WebSettings { private boolean mXSSAuditorEnabled = false; // HTML5 configuration parameters private long mAppCacheMaxSize = Long.MAX_VALUE; - private String mAppCachePath = ""; + private String mAppCachePath = null; private String mDatabasePath = ""; // The WebCore DatabaseTracker only allows the database path to be set // once. Keep track of when the path has been set. @@ -1370,8 +1370,8 @@ public class WebSettings { } /** - * Tell the WebView to enable Application Caches API. - * @param flag True if the WebView should enable Application Caches. + * Enable or disable the Application Cache API. + * @param flag Whether to enable the Application Cache API. */ public synchronized void setAppCacheEnabled(boolean flag) { if (mAppCacheEnabled != flag) { @@ -1381,15 +1381,19 @@ public class WebSettings { } /** - * Set a custom path to the Application Caches files. The client - * must ensure it exists before this call. - * @param appCachePath String path to the directory containing Application - * Caches files. The appCache path can be the empty string but should not - * be null. Passing null for this parameter will result in a no-op. + * Set the path used by the Application Cache API to store files. This + * setting is applied to all WebViews in the application. In order for the + * Application Cache API to function, this method must be called with a + * path which exists and is writable by the application. This method may + * only be called once: repeated calls are ignored. + * @param path Path to the directory that should be used to store Application + * Cache files. */ - public synchronized void setAppCachePath(String appCachePath) { - if (appCachePath != null && !appCachePath.equals(mAppCachePath)) { - mAppCachePath = appCachePath; + public synchronized void setAppCachePath(String path) { + // We test for a valid path and for repeated setting on the native + // side, but we can avoid syncing in some simple cases. + if (mAppCachePath == null && path != null && !path.isEmpty()) { + mAppCachePath = path; postSync(); } } |