summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/CookieManager.cpp
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-12-06 10:43:52 +0000
committerIain Merrick <husky@google.com>2010-12-06 16:09:54 +0000
commitc65c296d5bbf1608aedeceac90179a261deb0368 (patch)
treee9178ab9aaf50ba7472a89708e5cb7e9c1921fd9 /WebKit/android/jni/CookieManager.cpp
parentb552bd9285b27da2142b3078a06bdfe022a59410 (diff)
downloadexternal_webkit-c65c296d5bbf1608aedeceac90179a261deb0368.zip
external_webkit-c65c296d5bbf1608aedeceac90179a261deb0368.tar.gz
external_webkit-c65c296d5bbf1608aedeceac90179a261deb0368.tar.bz2
Fix CookieManager.hasCookies().
To pass the CTS test, this method needs to check the persistent database directly, ignoring any cookies that are only stored in memory. Depends on change Id498d281 in external/chromium, which adds the GetCookieCount() method. Change-Id: Ibeceaaa9942b5f4f1160fc2eeeca8b2322169a90
Diffstat (limited to 'WebKit/android/jni/CookieManager.cpp')
-rw-r--r--WebKit/android/jni/CookieManager.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/WebKit/android/jni/CookieManager.cpp b/WebKit/android/jni/CookieManager.cpp
index 5532f6a..0ba767c 100644
--- a/WebKit/android/jni/CookieManager.cpp
+++ b/WebKit/android/jni/CookieManager.cpp
@@ -83,7 +83,7 @@ static jstring getCookie(JNIEnv* env, jobject, jstring url)
static bool hasCookies(JNIEnv*, jobject)
{
#if USE(CHROME_NETWORK_STACK)
- return !WebCookieJar::get(false)->cookieStore()->GetCookieMonster()->GetAllCookies().empty();
+ return WebCookieJar::get(false)->getNumCookiesInDatabase() > 0;
#else
// The Android HTTP stack is implemented Java-side.
ASSERT_NOT_REACHED();
@@ -101,6 +101,10 @@ static void removeAllCookie(JNIEnv*, jobject)
// TODO: Consider adding an optimisation to not create the context if it
// doesn't already exist.
WebCookieJar::get(true)->cookieStore()->GetCookieMonster()->DeleteAllCreatedAfter(Time(), true);
+
+ // The Java code removes cookies directly from the backing database, so we do the same,
+ // but with a NULL callback so it's asynchronous.
+ WebCookieJar::get(true)->cookieStore()->GetCookieMonster()->FlushStore(NULL);
#endif
}