diff options
author | Steve Block <steveblock@google.com> | 2012-01-04 05:36:57 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-04 05:36:57 -0800 |
commit | 7b061309fabb6fdf9e40a48dd4feaac6ffa29710 (patch) | |
tree | 722d8f883acb96e273a090246d042a6147db6b6a /core/java/android/webkit/WebSettings.java | |
parent | b4f7bbc57c17375a75e5128ae84842b38b550c46 (diff) | |
parent | 92f30c3d5f39bd33dcab8c3d31e156ea3188a67a (diff) | |
download | frameworks_base-7b061309fabb6fdf9e40a48dd4feaac6ffa29710.zip frameworks_base-7b061309fabb6fdf9e40a48dd4feaac6ffa29710.tar.gz frameworks_base-7b061309fabb6fdf9e40a48dd4feaac6ffa29710.tar.bz2 |
Merge "Fix AppCache when either no path or an invalid path is supplied"
Diffstat (limited to 'core/java/android/webkit/WebSettings.java')
-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 61eedac..617584b 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(); } } |