summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/CookieManager.java
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:51:23 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:51:23 -0800
commitb798689749c64baba81f02e10cf2157c747d6b46 (patch)
treeda394a395ddb1a6cf69193314846b03fe47a397e /core/java/android/webkit/CookieManager.java
parentf013e1afd1e68af5e3b868c26a653bbfb39538f8 (diff)
downloadframeworks_base-b798689749c64baba81f02e10cf2157c747d6b46.zip
frameworks_base-b798689749c64baba81f02e10cf2157c747d6b46.tar.gz
frameworks_base-b798689749c64baba81f02e10cf2157c747d6b46.tar.bz2
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'core/java/android/webkit/CookieManager.java')
-rw-r--r--core/java/android/webkit/CookieManager.java85
1 files changed, 53 insertions, 32 deletions
diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java
index 00b17d2..5a37f04 100644
--- a/core/java/android/webkit/CookieManager.java
+++ b/core/java/android/webkit/CookieManager.java
@@ -172,7 +172,7 @@ public final class CookieManager {
if (urlPath.startsWith(path)) {
int len = path.length();
int urlLen = urlPath.length();
- if (urlLen > len) {
+ if (path.charAt(len-1) != PATH_DELIM && urlLen > len) {
// make sure /wee doesn't match /we
return urlPath.charAt(len) == PATH_DELIM;
}
@@ -440,29 +440,43 @@ public final class CookieManager {
/**
* Remove all session cookies, which are cookies without expiration date
*/
- public synchronized void removeSessionCookie() {
- Collection<ArrayList<Cookie>> cookieList = mCookieMap.values();
- Iterator<ArrayList<Cookie>> listIter = cookieList.iterator();
- while (listIter.hasNext()) {
- ArrayList<Cookie> list = listIter.next();
- Iterator<Cookie> iter = list.iterator();
- while (iter.hasNext()) {
- Cookie cookie = iter.next();
- if (cookie.expires == -1) {
- iter.remove();
+ public void removeSessionCookie() {
+ final Runnable clearCache = new Runnable() {
+ public void run() {
+ synchronized(CookieManager.this) {
+ Collection<ArrayList<Cookie>> cookieList = mCookieMap.values();
+ Iterator<ArrayList<Cookie>> listIter = cookieList.iterator();
+ while (listIter.hasNext()) {
+ ArrayList<Cookie> list = listIter.next();
+ Iterator<Cookie> iter = list.iterator();
+ while (iter.hasNext()) {
+ Cookie cookie = iter.next();
+ if (cookie.expires == -1) {
+ iter.remove();
+ }
+ }
+ }
+ CookieSyncManager.getInstance().clearSessionCookies();
}
}
- }
- CookieSyncManager.getInstance().clearSessionCookies();
+ };
+ new Thread(clearCache).start();
}
/**
* Remove all cookies
*/
- public synchronized void removeAllCookie() {
- mCookieMap = new LinkedHashMap<String, ArrayList<Cookie>>(
- MAX_DOMAIN_COUNT, 0.75f, true);
- CookieSyncManager.getInstance().clearAllCookies();
+ public void removeAllCookie() {
+ final Runnable clearCache = new Runnable() {
+ public void run() {
+ synchronized(CookieManager.this) {
+ mCookieMap = new LinkedHashMap<String, ArrayList<Cookie>>(
+ MAX_DOMAIN_COUNT, 0.75f, true);
+ CookieSyncManager.getInstance().clearAllCookies();
+ }
+ }
+ };
+ new Thread(clearCache).start();
}
/**
@@ -475,23 +489,30 @@ public final class CookieManager {
/**
* Remove all expired cookies
*/
- public synchronized void removeExpiredCookie() {
- long now = System.currentTimeMillis();
- Collection<ArrayList<Cookie>> cookieList = mCookieMap.values();
- Iterator<ArrayList<Cookie>> listIter = cookieList.iterator();
- while (listIter.hasNext()) {
- ArrayList<Cookie> list = listIter.next();
- Iterator<Cookie> iter = list.iterator();
- while (iter.hasNext()) {
- Cookie cookie = iter.next();
- // expires == -1 means no expires defined. Otherwise negative
- // means far future
- if (cookie.expires > 0 && cookie.expires < now) {
- iter.remove();
+ public void removeExpiredCookie() {
+ final Runnable clearCache = new Runnable() {
+ public void run() {
+ synchronized(CookieManager.this) {
+ long now = System.currentTimeMillis();
+ Collection<ArrayList<Cookie>> cookieList = mCookieMap.values();
+ Iterator<ArrayList<Cookie>> listIter = cookieList.iterator();
+ while (listIter.hasNext()) {
+ ArrayList<Cookie> list = listIter.next();
+ Iterator<Cookie> iter = list.iterator();
+ while (iter.hasNext()) {
+ Cookie cookie = iter.next();
+ // expires == -1 means no expires defined. Otherwise
+ // negative means far future
+ if (cookie.expires > 0 && cookie.expires < now) {
+ iter.remove();
+ }
+ }
+ }
+ CookieSyncManager.getInstance().clearExpiredCookies(now);
}
}
- }
- CookieSyncManager.getInstance().clearExpiredCookies(now);
+ };
+ new Thread(clearCache).start();
}
/**