Changeset 142150 in webkit
- Timestamp:
- Feb 7, 2013 10:24:09 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142149 r142150 1 2013-02-07 Otto Derek Cheung <otcheung@rim.com> 2 3 [BlackBerry] Cookie database isn't loaded into memory in some rare cases 4 https://bugs.webkit.org/show_bug.cgi?id=109202 5 PR 286189 6 7 Reviewed by Yong Li. 8 Internally Reviewed by Konrad Piascik. 9 10 If a get/setCookie call is made before the database is loaded, or if there's some 11 kind of error that causes the loading of the database to fail in the constructor 12 of CookieManager, the browser will get into a state where it seems like cookie is 13 permanenty disabled. 14 15 Instead of logging the errors and redispatching the setCookie, we should do a force sync 16 to load the cookie database before continuing. 17 18 Since the bug is so difficult to reproduce (I never did so myself), I did the follow test 19 to make sure the code path is correct: 20 1) Make sure original implementation is retained - open and loading done in the constructor 21 2) Removed opening and loading in constructor, the new calls in get/setcookies loaded the db just fine (although with 22 an initial lag because we are blocking WKT while performing SQLite options). 23 3) Removed loading in constructor, the new calls loaded the db just fine. 24 25 * platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp: 26 (WebCore::CookieDatabaseBackingStore::openAndLoadDatabaseSynchronously): 27 (WebCore): 28 * platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.h: 29 (CookieDatabaseBackingStore): 30 * platform/blackberry/CookieManager.cpp: 31 (WebCore::CookieManager::setCookies): 32 (WebCore::CookieManager::getCookie): 33 (WebCore::CookieManager::generateHtmlFragmentForCookies): 34 (WebCore::CookieManager::getRawCookies): 35 1 36 2013-02-07 Max Vujovic <mvujovic@adobe.com> 2 37 -
trunk/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp
r137814 r142150 312 312 } 313 313 314 void CookieDatabaseBackingStore::openAndLoadDatabaseSynchronously(const String& cookieJar) 315 { 316 CookieLog("CookieBackingStore - loading database into CookieManager immediately"); 317 318 if (m_db.isOpen()) { 319 if (isCurrentThread()) 320 BlackBerry::Platform::webKitThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&CookieManager::getBackingStoreCookies, &cookieManager())); 321 else 322 cookieManager().getBackingStoreCookies(); 323 } else { 324 if (isCurrentThread()) 325 invokeOpen(cookieJar); 326 else 327 dispatchSyncMessage(createMethodCallMessage(&CookieDatabaseBackingStore::invokeOpen, this, cookieJar)); 328 } 329 } 330 314 331 void CookieDatabaseBackingStore::sendChangesToDatabaseSynchronously() 315 332 { -
trunk/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.h
r132944 r142150 60 60 void getCookiesFromDatabase(Vector<ParsedCookie*>& stackOfCookies, unsigned int limit = 0); 61 61 62 void openAndLoadDatabaseSynchronously(const String& cookieJar); 62 63 void sendChangesToDatabaseSynchronously(); 63 64 -
trunk/Source/WebCore/platform/blackberry/CookieManager.cpp
r138568 r142150 127 127 void CookieManager::setCookies(const KURL& url, const String& value, CookieFilter filter) 128 128 { 129 // Dispatch the message because the database cookies are not loaded in memory yet. 130 if (!m_syncedWithDatabase && !m_privateMode) { 131 typedef void (WebCore::CookieManager::*FunctionType)(const KURL&, const String&, CookieFilter); 132 133 BlackBerry::Platform::webKitThreadMessageClient()->dispatchMessage( 134 BlackBerry::Platform::createMethodCallMessage<FunctionType, CookieManager, const KURL, const String, CookieFilter>( 135 &CookieManager::setCookies, this, url, value, filter)); 136 return; 137 } 129 // If the database hasn't been sync-ed at this point, force a sync load 130 if (!m_syncedWithDatabase && !m_privateMode) 131 m_cookieBackingStore->openAndLoadDatabaseSynchronously(cookieJar()); 138 132 139 133 CookieLog("CookieManager - Setting cookies"); … … 149 143 void CookieManager::setCookies(const KURL& url, const Vector<String>& cookies, CookieFilter filter) 150 144 { 151 // Dispatch the message because the database cookies are not loaded in memory yet. 152 if (!m_syncedWithDatabase && !m_privateMode) { 153 typedef void (WebCore::CookieManager::*FunctionType)(const KURL&, const Vector<String>&, CookieFilter); 154 BlackBerry::Platform::webKitThreadMessageClient()->dispatchMessage( 155 BlackBerry::Platform::createMethodCallMessage<FunctionType, CookieManager, const KURL, const Vector<String>, CookieFilter>( 156 &CookieManager::setCookies, this, url, cookies, filter)); 157 return; 158 } 145 // If the database hasn't been sync-ed at this point, force a sync load 146 if (!m_syncedWithDatabase && !m_privateMode) 147 m_cookieBackingStore->openAndLoadDatabaseSynchronously(cookieJar()); 159 148 160 149 CookieLog("CookieManager - Setting cookies"); … … 169 158 String CookieManager::getCookie(const KURL& url, CookieFilter filter) const 170 159 { 171 if (!m_syncedWithDatabase && !m_privateMode) { 172 LOG_ERROR("CookieManager is calling getCookies before database values are loaded."); 173 return String(); 174 } 160 // If the database hasn't been sync-ed at this point, force a sync load 161 if (!m_syncedWithDatabase && !m_privateMode) 162 m_cookieBackingStore->openAndLoadDatabaseSynchronously(cookieJar()); 175 163 176 164 Vector<ParsedCookie*> rawCookies; … … 199 187 String CookieManager::generateHtmlFragmentForCookies() 200 188 { 201 if (!m_syncedWithDatabase && !m_privateMode) { 202 LOG_ERROR("CookieManager is calling generateHtmlFragmentForCookies before database values are loaded."); 203 return String(); 204 } 189 // If the database hasn't been sync-ed at this point, force a sync load 190 if (!m_syncedWithDatabase && !m_privateMode) 191 m_cookieBackingStore->openAndLoadDatabaseSynchronously(cookieJar()); 205 192 206 193 CookieLog("CookieManager - generateHtmlFragmentForCookies\n"); … … 239 226 void CookieManager::getRawCookies(Vector<ParsedCookie*> &stackOfCookies, const KURL& requestURL, CookieFilter filter) const 240 227 { 241 if (!m_syncedWithDatabase && !m_privateMode) { 242 LOG_ERROR("CookieManager is calling getRawCookies before database values are loaded."); 243 return; 244 } 228 // Force a sync load of the database 229 if (!m_syncedWithDatabase && !m_privateMode) 230 m_cookieBackingStore->openAndLoadDatabaseSynchronously(cookieJar()); 245 231 246 232 CookieLog("CookieManager - getRawCookies - processing url with domain - %s & protocol: %s & path: %s\n", requestURL.host().utf8().data(), requestURL.protocol().utf8().data(), requestURL.path().utf8().data());
Note: See TracChangeset
for help on using the changeset viewer.