[BlackBerry] Cookie database isn't loaded into memory in some rare cases
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 18:24:09 +0000 (18:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 18:24:09 +0000 (18:24 +0000)
commit68913a17d9449172b99d692aa70fd7cf1b141aeb
tree85f3f046593f33490a899be74009fa31efb31456
parentb70c98bf9271558a72a870598c50cedf7b71458e
[BlackBerry] Cookie database isn't loaded into memory in some rare cases
https://bugs.webkit.org/show_bug.cgi?id=109202
PR 286189

Patch by Otto Derek Cheung <otcheung@rim.com> on 2013-02-07
Reviewed by Yong Li.
Internally Reviewed by Konrad Piascik.

If a get/setCookie call is made before the database is loaded, or if there's some
kind of error that causes the loading of the database to fail in the constructor
of CookieManager, the browser will get into a state where it seems like cookie is
permanenty disabled.

Instead of logging the errors and redispatching the setCookie, we should do a force sync
to load the cookie database before continuing.

Since the bug is so difficult to reproduce (I never did so myself), I did the follow test
to make sure the code path is correct:
1) Make sure original implementation is retained - open and loading done in the constructor
2) Removed opening and loading in constructor, the new calls in get/setcookies loaded the db just fine (although with
an initial lag because we are blocking WKT while performing SQLite options).
3) Removed loading in constructor, the new calls loaded the db just fine.

* platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp:
(WebCore::CookieDatabaseBackingStore::openAndLoadDatabaseSynchronously):
(WebCore):
* platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.h:
(CookieDatabaseBackingStore):
* platform/blackberry/CookieManager.cpp:
(WebCore::CookieManager::setCookies):
(WebCore::CookieManager::getCookie):
(WebCore::CookieManager::generateHtmlFragmentForCookies):
(WebCore::CookieManager::getRawCookies):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp
Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.h
Source/WebCore/platform/blackberry/CookieManager.cpp