summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebSettings.java
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2012-01-04 05:36:57 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-04 05:36:57 -0800
commit7b061309fabb6fdf9e40a48dd4feaac6ffa29710 (patch)
tree722d8f883acb96e273a090246d042a6147db6b6a /core/java/android/webkit/WebSettings.java
parentb4f7bbc57c17375a75e5128ae84842b38b550c46 (diff)
parent92f30c3d5f39bd33dcab8c3d31e156ea3188a67a (diff)
downloadframeworks_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.java26
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();
}
}