WebKit2: The WebProcess should be relaunched if necessary when WebKit2 is asked for
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Mar 2011 20:45:20 +0000 (20:45 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Mar 2011 20:45:20 +0000 (20:45 +0000)
information about Cookies, Databases, Local Storage, etc.
https://bugs.webkit.org/show_bug.cgi?id=57374

Reviewed by Anders Carlsson.

Instead of bailing when the WebProcess is not valid, call relaunchProcessIfNecessary().

* UIProcess/Plugins/WebPluginSiteDataManager.cpp:
(WebKit::WebPluginSiteDataManager::getSitesWithData):
(WebKit::WebPluginSiteDataManager::clearSiteData):
* UIProcess/WebApplicationCacheManagerProxy.cpp:
(WebKit::WebApplicationCacheManagerProxy::getApplicationCacheOrigins):
(WebKit::WebApplicationCacheManagerProxy::deleteEntriesForOrigin):
(WebKit::WebApplicationCacheManagerProxy::deleteAllEntries):
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
(WebKit::WebCookieManagerProxy::deleteCookiesForHostname):
(WebKit::WebCookieManagerProxy::deleteAllCookies):
(WebKit::WebCookieManagerProxy::startObservingCookieChanges):
(WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
* UIProcess/WebDatabaseManagerProxy.cpp:
(WebKit::WebDatabaseManagerProxy::getDatabasesByOrigin):
(WebKit::WebDatabaseManagerProxy::getDatabaseOrigins):
(WebKit::WebDatabaseManagerProxy::deleteDatabaseWithNameForOrigin):
(WebKit::WebDatabaseManagerProxy::deleteDatabasesForOrigin):
(WebKit::WebDatabaseManagerProxy::deleteAllDatabases):
(WebKit::WebDatabaseManagerProxy::setQuotaForOrigin):
* UIProcess/WebKeyValueStorageManagerProxy.cpp:
(WebKit::WebKeyValueStorageManagerProxy::getKeyValueStorageOrigins):
(WebKit::WebKeyValueStorageManagerProxy::deleteEntriesForOrigin):
(WebKit::WebKeyValueStorageManagerProxy::deleteAllEntries):
* UIProcess/WebMediaCacheManagerProxy.cpp:
(WebKit::WebMediaCacheManagerProxy::getHostnamesWithMediaCache):
(WebKit::WebMediaCacheManagerProxy::clearCacheForHostname):
(WebKit::WebMediaCacheManagerProxy::clearCacheForAllHostnames):
* UIProcess/WebResourceCacheManagerProxy.cpp:
(WebKit::WebResourceCacheManagerProxy::getCacheOrigins):
(WebKit::WebResourceCacheManagerProxy::clearCacheForOrigin):
(WebKit::WebResourceCacheManagerProxy::clearCacheForAllOrigins):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@82312 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp
Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp
Source/WebKit2/UIProcess/WebKeyValueStorageManagerProxy.cpp
Source/WebKit2/UIProcess/WebMediaCacheManagerProxy.cpp
Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp

index 2087cb8..7c66b15 100644 (file)
@@ -1,3 +1,47 @@
+2011-03-29  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        WebKit2: The WebProcess should be relaunched if necessary when WebKit2 is asked for
+        information about Cookies, Databases, Local Storage, etc.
+        https://bugs.webkit.org/show_bug.cgi?id=57374
+
+        Instead of bailing when the WebProcess is not valid, call relaunchProcessIfNecessary().
+
+        * UIProcess/Plugins/WebPluginSiteDataManager.cpp:
+        (WebKit::WebPluginSiteDataManager::getSitesWithData):
+        (WebKit::WebPluginSiteDataManager::clearSiteData):
+        * UIProcess/WebApplicationCacheManagerProxy.cpp:
+        (WebKit::WebApplicationCacheManagerProxy::getApplicationCacheOrigins):
+        (WebKit::WebApplicationCacheManagerProxy::deleteEntriesForOrigin):
+        (WebKit::WebApplicationCacheManagerProxy::deleteAllEntries):
+        * UIProcess/WebCookieManagerProxy.cpp:
+        (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
+        (WebKit::WebCookieManagerProxy::deleteCookiesForHostname):
+        (WebKit::WebCookieManagerProxy::deleteAllCookies):
+        (WebKit::WebCookieManagerProxy::startObservingCookieChanges):
+        (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
+        (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
+        * UIProcess/WebDatabaseManagerProxy.cpp:
+        (WebKit::WebDatabaseManagerProxy::getDatabasesByOrigin):
+        (WebKit::WebDatabaseManagerProxy::getDatabaseOrigins):
+        (WebKit::WebDatabaseManagerProxy::deleteDatabaseWithNameForOrigin):
+        (WebKit::WebDatabaseManagerProxy::deleteDatabasesForOrigin):
+        (WebKit::WebDatabaseManagerProxy::deleteAllDatabases):
+        (WebKit::WebDatabaseManagerProxy::setQuotaForOrigin):
+        * UIProcess/WebKeyValueStorageManagerProxy.cpp:
+        (WebKit::WebKeyValueStorageManagerProxy::getKeyValueStorageOrigins):
+        (WebKit::WebKeyValueStorageManagerProxy::deleteEntriesForOrigin):
+        (WebKit::WebKeyValueStorageManagerProxy::deleteAllEntries):
+        * UIProcess/WebMediaCacheManagerProxy.cpp:
+        (WebKit::WebMediaCacheManagerProxy::getHostnamesWithMediaCache):
+        (WebKit::WebMediaCacheManagerProxy::clearCacheForHostname):
+        (WebKit::WebMediaCacheManagerProxy::clearCacheForAllHostnames):
+        * UIProcess/WebResourceCacheManagerProxy.cpp:
+        (WebKit::WebResourceCacheManagerProxy::getCacheOrigins):
+        (WebKit::WebResourceCacheManagerProxy::clearCacheForOrigin):
+        (WebKit::WebResourceCacheManagerProxy::clearCacheForAllOrigins):
+
 2011-03-29  Jeff Miller  <jeffm@apple.com>
 
         Reviewed by Darin Adler.
index dfa0806..5f56d0b 100644 (file)
@@ -163,11 +163,7 @@ void WebPluginSiteDataManager::getSitesWithData(PassRefPtr<ArrayCallback> prpCal
     m_pendingGetSitesWithData.set(callbackID, state);
     state->getSitesWithDataForNextPlugin();
 #else
-    if (!m_webContext->hasValidProcess()) {
-        RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
 
     Vector<String> pluginPaths;
     m_webContext->pluginInfoStore()->getPluginPaths(pluginPaths);
@@ -227,11 +223,7 @@ void WebPluginSiteDataManager::clearSiteData(ImmutableArray* sites, uint64_t fla
     state->clearSiteDataForNextPlugin();
 #else
 
-    if (!m_webContext->hasValidProcess()) {
-        RefPtr<VoidCallback> callback = m_voidCallbacks.take(callbackID);
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
     Vector<String> pluginPaths;
     m_webContext->pluginInfoStore()->getPluginPaths(pluginPaths);
     m_webContext->ensureWebProcess();    
index 1cf4921..cf5eda1 100644 (file)
@@ -60,10 +60,7 @@ void WebApplicationCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* con
 void WebApplicationCacheManagerProxy::getApplicationCacheOrigins(PassRefPtr<ArrayCallback> prpCallback)
 {
     RefPtr<ArrayCallback> callback = prpCallback;
-    if (!m_webContext->hasValidProcess()) {
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
     
     uint64_t callbackID = callback->callbackID();
     m_arrayCallbacks.set(callbackID, callback.release());
@@ -78,8 +75,7 @@ void WebApplicationCacheManagerProxy::didGetApplicationCacheOrigins(const Vector
 
 void WebApplicationCacheManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* origin)
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     
     SecurityOriginData securityOriginData;
     securityOriginData.protocol = origin->protocol();
@@ -91,8 +87,7 @@ void WebApplicationCacheManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin*
 
 void WebApplicationCacheManagerProxy::deleteAllEntries()
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebApplicationCacheManager::DeleteAllEntries(), 0);
 }
 
index efe9007..c2ae441 100644 (file)
@@ -68,10 +68,7 @@ void WebCookieManagerProxy::getHostnamesWithCookies(PassRefPtr<ArrayCallback> pr
     ASSERT(m_webContext);
 
     RefPtr<ArrayCallback> callback = prpCallback;
-    if (!m_webContext->hasValidProcess()) {
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
     
     uint64_t callbackID = callback->callbackID();
     m_arrayCallbacks.set(callbackID, callback.release());
@@ -98,24 +95,21 @@ void WebCookieManagerProxy::didGetHostnamesWithCookies(const Vector<String>& hos
 void WebCookieManagerProxy::deleteCookiesForHostname(const String& hostname)
 {
     ASSERT(m_webContext);
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebCookieManager::DeleteCookiesForHostname(hostname), 0);
 }
 
 void WebCookieManagerProxy::deleteAllCookies()
 {
     ASSERT(m_webContext);
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebCookieManager::DeleteAllCookies(), 0);
 }
 
 void WebCookieManagerProxy::startObservingCookieChanges()
 {
     ASSERT(m_webContext);
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebCookieManager::StartObservingCookieChanges(), 0);
 }
 
@@ -135,9 +129,7 @@ void WebCookieManagerProxy::cookiesDidChange()
 void WebCookieManagerProxy::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
 {
     ASSERT(m_webContext);
-    if (!m_webContext->hasValidProcess())
-        return;
-
+    m_webContext->relaunchProcessIfNecessary();
 #if PLATFORM(MAC)
     persistHTTPCookieAcceptPolicy(policy);
 #endif
@@ -149,10 +141,7 @@ void WebCookieManagerProxy::getHTTPCookieAcceptPolicy(PassRefPtr<HTTPCookieAccep
     ASSERT(m_webContext);
 
     RefPtr<HTTPCookieAcceptPolicyCallback> callback = prpCallback;
-    if (!m_webContext->hasValidProcess()) {
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
 
     uint64_t callbackID = callback->callbackID();
     m_httpCookieAcceptPolicyCallbacks.set(callbackID, callback.release());
index 96488fb..45ccb0e 100644 (file)
@@ -111,10 +111,7 @@ void WebDatabaseManagerProxy::initializeClient(const WKDatabaseManagerClient* cl
 void WebDatabaseManagerProxy::getDatabasesByOrigin(PassRefPtr<ArrayCallback> prpCallback)
 {
     RefPtr<ArrayCallback> callback = prpCallback;
-    if (!m_webContext->hasValidProcess()) {
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
     uint64_t callbackID = callback->callbackID();
     m_arrayCallbacks.set(callbackID, callback.release());
     m_webContext->process()->send(Messages::WebDatabaseManager::GetDatabasesByOrigin(callbackID), 0);
@@ -167,10 +164,7 @@ void WebDatabaseManagerProxy::didGetDatabasesByOrigin(const Vector<OriginAndData
 void WebDatabaseManagerProxy::getDatabaseOrigins(PassRefPtr<ArrayCallback> prpCallback)
 {
     RefPtr<ArrayCallback> callback = prpCallback;
-    if (!m_webContext->hasValidProcess()) {
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
     uint64_t callbackID = callback->callbackID();
     m_arrayCallbacks.set(callbackID, callback.release());
     m_webContext->process()->send(Messages::WebDatabaseManager::GetDatabaseOrigins(callbackID), 0);
@@ -195,29 +189,25 @@ void WebDatabaseManagerProxy::didGetDatabaseOrigins(const Vector<String>& origin
 
 void WebDatabaseManagerProxy::deleteDatabaseWithNameForOrigin(const String& databaseIdentifier, WebSecurityOrigin* origin)
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebDatabaseManager::DeleteDatabaseWithNameForOrigin(databaseIdentifier, origin->databaseIdentifier()), 0);
 }
 
 void WebDatabaseManagerProxy::deleteDatabasesForOrigin(WebSecurityOrigin* origin)
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebDatabaseManager::DeleteDatabasesForOrigin(origin->databaseIdentifier()), 0);
 }
 
 void WebDatabaseManagerProxy::deleteAllDatabases()
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebDatabaseManager::DeleteAllDatabases(), 0);
 }
 
 void WebDatabaseManagerProxy::setQuotaForOrigin(WebSecurityOrigin* origin, uint64_t quota)
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebDatabaseManager::SetQuotaForOrigin(origin->databaseIdentifier(), quota), 0);
 }
 
index dafa613..31aaf1d 100644 (file)
@@ -60,10 +60,7 @@ void WebKeyValueStorageManagerProxy::didReceiveMessage(CoreIPC::Connection* conn
 void WebKeyValueStorageManagerProxy::getKeyValueStorageOrigins(PassRefPtr<ArrayCallback> prpCallback)
 {
     RefPtr<ArrayCallback> callback = prpCallback;
-    if (!m_webContext->hasValidProcess()) {
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
     
     uint64_t callbackID = callback->callbackID();
     m_arrayCallbacks.set(callbackID, callback.release());
@@ -78,8 +75,7 @@ void WebKeyValueStorageManagerProxy::didGetKeyValueStorageOrigins(const Vector<S
 
 void WebKeyValueStorageManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* origin)
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     
     SecurityOriginData securityOriginData;
     securityOriginData.protocol = origin->protocol();
@@ -91,9 +87,7 @@ void WebKeyValueStorageManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* o
 
 void WebKeyValueStorageManagerProxy::deleteAllEntries()
 {
-    if (!m_webContext->hasValidProcess())
-        return;
-
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebKeyValueStorageManager::DeleteAllEntries(), 0);
 }
 
index f0eb619..a731891 100644 (file)
@@ -59,10 +59,7 @@ void WebMediaCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* connectio
 void WebMediaCacheManagerProxy::getHostnamesWithMediaCache(PassRefPtr<ArrayCallback> prpCallback)
 {
     RefPtr<ArrayCallback> callback = prpCallback;
-    if (!m_webContext->hasValidProcess()) {
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
     
     uint64_t callbackID = callback->callbackID();
     m_arrayCallbacks.set(callbackID, callback.release());
@@ -88,17 +85,13 @@ void WebMediaCacheManagerProxy::didGetHostnamesWithMediaCache(const Vector<Strin
 
 void WebMediaCacheManagerProxy::clearCacheForHostname(const String& hostname)
 {
-    if (!m_webContext->hasValidProcess())
-        return;
-
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebMediaCacheManager::ClearCacheForHostname(hostname), 0);
 }
 
 void WebMediaCacheManagerProxy::clearCacheForAllHostnames()
 {
-    if (!m_webContext->hasValidProcess())
-        return;
-
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebMediaCacheManager::ClearCacheForAllHostnames(), 0);
 }
 
index aa65113..62296f4 100644 (file)
@@ -59,10 +59,7 @@ void WebResourceCacheManagerProxy::invalidate()
 void WebResourceCacheManagerProxy::getCacheOrigins(PassRefPtr<ArrayCallback> prpCallback)
 {
     RefPtr<ArrayCallback> callback = prpCallback;
-    if (!m_webContext->hasValidProcess()) {
-        callback->invalidate();
-        return;
-    }
+    m_webContext->relaunchProcessIfNecessary();
     uint64_t callbackID = callback->callbackID();
     m_arrayCallbacks.set(callbackID, callback.release());
     m_webContext->process()->send(Messages::WebResourceCacheManager::GetCacheOrigins(callbackID), 0);
@@ -76,8 +73,7 @@ void WebResourceCacheManagerProxy::didGetCacheOrigins(const Vector<SecurityOrigi
 
 void WebResourceCacheManagerProxy::clearCacheForOrigin(WebSecurityOrigin* origin)
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
 
     SecurityOriginData securityOrigin;
     securityOrigin.protocol = origin->protocol();
@@ -88,8 +84,7 @@ void WebResourceCacheManagerProxy::clearCacheForOrigin(WebSecurityOrigin* origin
 
 void WebResourceCacheManagerProxy::clearCacheForAllOrigins()
 {
-    if (!m_webContext->hasValidProcess())
-        return;
+    m_webContext->relaunchProcessIfNecessary();
     m_webContext->process()->send(Messages::WebResourceCacheManager::ClearCacheForAllOrigins(), 0);
 }