diff options
author | droger <droger@chromium.org> | 2016-02-22 11:19:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-22 19:20:45 +0000 |
commit | 4c3ea11423d4ce91dca5dd8e151e59caa0423e13 (patch) | |
tree | 360fd2929020a804e02b70f5e42d2fada9ff5bd9 /ios/net | |
parent | ada03f7b2872ca6be60fb5cd6e23e958a457718c (diff) | |
download | chromium_src-4c3ea11423d4ce91dca5dd8e151e59caa0423e13.zip chromium_src-4c3ea11423d4ce91dca5dd8e151e59caa0423e13.tar.gz chromium_src-4c3ea11423d4ce91dca5dd8e151e59caa0423e13.tar.bz2 |
[iOS] Support empty callbacks in all CookieStoreIOS methods.
This CL adds the missing tests for empty callbacks, to match the other
CookieStore implementations.
Callers do expect empty callbacks to be supported, resulting in actual
crashes. This CL fixes these crashes.
BUG=587930
Review URL: https://codereview.chromium.org/1717253002
Cr-Commit-Position: refs/heads/master@{#376771}
Diffstat (limited to 'ios/net')
-rw-r--r-- | ios/net/cookies/cookie_store_ios.mm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm index f50f0f8..70cff4f 100644 --- a/ios/net/cookies/cookie_store_ios.mm +++ b/ios/net/cookies/cookie_store_ios.mm @@ -1081,7 +1081,8 @@ void CookieStoreIOS::DidClearBinaryCookiesFileCookies( CookieStoreIOSClient* client = net::GetCookieStoreIOSClient(); DCHECK(client); client->DidChangeCookieStorage(); - callback.Run(num_deleted_from_nshttp_cookie_storage); + if (!callback.is_null()) + callback.Run(num_deleted_from_nshttp_cookie_storage); } void CookieStoreIOS::UpdateCachesFromCookieMonster() { @@ -1099,20 +1100,23 @@ void CookieStoreIOS::UpdateCachesAfterSet(const SetCookiesCallback& callback, DCHECK(thread_checker_.CalledOnValidThread()); if (success) UpdateCachesFromCookieMonster(); - callback.Run(success); + if (!callback.is_null()) + callback.Run(success); } void CookieStoreIOS::UpdateCachesAfterDelete(const DeleteCallback& callback, int num_deleted) { DCHECK(thread_checker_.CalledOnValidThread()); UpdateCachesFromCookieMonster(); - callback.Run(num_deleted); + if (!callback.is_null()) + callback.Run(num_deleted); } void CookieStoreIOS::UpdateCachesAfterClosure(const base::Closure& callback) { DCHECK(thread_checker_.CalledOnValidThread()); UpdateCachesFromCookieMonster(); - callback.Run(); + if (!callback.is_null()) + callback.Run(); } net::CookieList |