Title: [158101] trunk/Source/WebKit2
Revision
158101
Author
[email protected]
Date
2013-10-27 22:42:36 -0700 (Sun, 27 Oct 2013)

Log Message

WebIconDatabase can miss private browsing state changes.
<rdar://problem/15322318> and https://bugs.webkit.org/show_bug.cgi?id=123375

Reviewed by Alexey Proskuryakov.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::willStartUsingPrivateBrowsing): Call setAnyPageGroupMightHavePrivateBrowsingEnabled(true) on each context.
(WebKit::WebContext::willStopUsingPrivateBrowsing): Call setAnyPageGroupMightHavePrivateBrowsingEnabled(false) on each context.
(WebKit::WebContext::setPrivateBrowsingEnabled): In addition to notifying other processes about private browsing
  sessions, notify the context’s WebIconDatabase about the change in value.
* UIProcess/WebContext.h:

* UIProcess/WebIconDatabase.cpp:
(WebKit::WebIconDatabase::setDatabasePath): Prime the IconDatabase with an initial private browsing value.
(WebKit::WebIconDatabase::setAnyPageGroupMightHavePrivateBrowsingEnabled):
* UIProcess/WebIconDatabase.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (158100 => 158101)


--- trunk/Source/WebKit2/ChangeLog	2013-10-28 01:59:40 UTC (rev 158100)
+++ trunk/Source/WebKit2/ChangeLog	2013-10-28 05:42:36 UTC (rev 158101)
@@ -1,3 +1,22 @@
+2013-10-27  Brady Eidson  <[email protected]>
+
+        WebIconDatabase can miss private browsing state changes.
+        <rdar://problem/15322318> and https://bugs.webkit.org/show_bug.cgi?id=123375
+
+        Reviewed by Alexey Proskuryakov.
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::willStartUsingPrivateBrowsing): Call setAnyPageGroupMightHavePrivateBrowsingEnabled(true) on each context.
+        (WebKit::WebContext::willStopUsingPrivateBrowsing): Call setAnyPageGroupMightHavePrivateBrowsingEnabled(false) on each context.
+        (WebKit::WebContext::setPrivateBrowsingEnabled): In addition to notifying other processes about private browsing
+          sessions, notify the context’s WebIconDatabase about the change in value.
+        * UIProcess/WebContext.h:
+
+        * UIProcess/WebIconDatabase.cpp:
+        (WebKit::WebIconDatabase::setDatabasePath): Prime the IconDatabase with an initial private browsing value.
+        (WebKit::WebIconDatabase::setAnyPageGroupMightHavePrivateBrowsingEnabled):
+        * UIProcess/WebIconDatabase.h:
+
 2013-10-26  Tim Horton  <[email protected]>
 
         [mac] Remove WebTiledLayer

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (158100 => 158101)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2013-10-28 01:59:40 UTC (rev 158100)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2013-10-28 05:42:36 UTC (rev 158101)
@@ -428,26 +428,34 @@
 void WebContext::willStartUsingPrivateBrowsing()
 {
     const Vector<WebContext*>& contexts = allContexts();
-    for (size_t i = 0, count = contexts.size(); i < count; ++i) {
-#if ENABLE(NETWORK_PROCESS)
-        if (contexts[i]->usesNetworkProcess() && contexts[i]->networkProcess())
-            contexts[i]->networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession(), 0);
-#endif
-        contexts[i]->sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession());
-    }
+    for (size_t i = 0, count = contexts.size(); i < count; ++i)
+        contexts[i]->setAnyPageGroupMightHavePrivateBrowsingEnabled(true);
 }
 
 void WebContext::willStopUsingPrivateBrowsing()
 {
     const Vector<WebContext*>& contexts = allContexts();
-    for (size_t i = 0, count = contexts.size(); i < count; ++i) {
+    for (size_t i = 0, count = contexts.size(); i < count; ++i)
+        contexts[i]->setAnyPageGroupMightHavePrivateBrowsingEnabled(false);
+}
+
+void WebContext::setAnyPageGroupMightHavePrivateBrowsingEnabled(bool privateBrowsingEnabled)
+{
+    m_iconDatabase->setPrivateBrowsingEnabled(privateBrowsingEnabled);
+
 #if ENABLE(NETWORK_PROCESS)
-        if (contexts[i]->usesNetworkProcess() && contexts[i]->networkProcess())
-            contexts[i]->networkProcess()->send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(), 0);
-#endif
+    if (usesNetworkProcess() && networkProcess()) {
+        if (privateBrowsingEnabled)
+            networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession(), 0);
+        else
+            networkProcess()->send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(), 0);
+    }
+#endif // ENABLED(NETWORK_PROCESS)
 
-        contexts[i]->sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession());
-    }
+    if (privateBrowsingEnabled)
+        sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession());
+    else
+        sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession());
 }
 
 void (*s_invalidMessageCallback)(WKStringRef messageName);

Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (158100 => 158101)


--- trunk/Source/WebKit2/UIProcess/WebContext.h	2013-10-28 01:59:40 UTC (rev 158100)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h	2013-10-28 05:42:36 UTC (rev 158101)
@@ -398,6 +398,8 @@
     void addPlugInAutoStartOriginHash(const String& pageOrigin, unsigned plugInOriginHash);
     void plugInDidReceiveUserInteraction(unsigned plugInOriginHash);
 
+    void setAnyPageGroupMightHavePrivateBrowsingEnabled(bool);
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
     // PluginInfoStoreClient:
     virtual void pluginInfoStoreDidLoadPlugins(PluginInfoStore*) OVERRIDE;

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp (158100 => 158101)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2013-10-28 01:59:40 UTC (rev 158100)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2013-10-28 05:42:36 UTC (rev 158101)
@@ -31,6 +31,7 @@
 #include "WebContext.h"
 #include "WebIconDatabaseMessages.h"
 #include "WebIconDatabaseProxyMessages.h"
+#include "WebPreferences.h"
 #include <WebCore/FileSystem.h>
 #include <WebCore/IconDatabase.h>
 #include <WebCore/IconDatabaseBase.h>
@@ -75,6 +76,11 @@
     IconDatabase::delayDatabaseCleanup();
     m_databaseCleanupDisabled = true;
     m_iconDatabaseImpl->setEnabled(true);
+
+    // FIXME: WebIconDatabases are per-WebContext but WebContext's don't have their own notion of the current private browsing setting.
+    // As we clean up private browsing throughout the stack we need to clean it up here.
+    m_iconDatabaseImpl->setPrivateBrowsingEnabled(WebPreferences::anyPageGroupsAreUsingPrivateBrowsing());
+
     if (!m_iconDatabaseImpl->open(directoryName(path), pathGetFileName(path))) {
         LOG_ERROR("Unable to open WebKit2 icon database on disk");
         m_iconDatabaseImpl.clear();
@@ -293,4 +299,10 @@
     didChangeIconForPageURL(pageURL);
 }
 
+void WebIconDatabase::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
+{
+    if (m_iconDatabaseImpl)
+        m_iconDatabaseImpl->setPrivateBrowsingEnabled(privateBrowsingEnabled);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.h (158100 => 158101)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.h	2013-10-28 01:59:40 UTC (rev 158100)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.h	2013-10-28 05:42:36 UTC (rev 158101)
@@ -87,6 +87,8 @@
 
     void initializeIconDatabaseClient(const WKIconDatabaseClient*);
 
+    void setPrivateBrowsingEnabled(bool);
+    
 private:
     WebIconDatabase(WebContext*);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to