Title: [158960] branches/safari-537.73-branch/Source/WebKit2

Diff

Modified: branches/safari-537.73-branch/Source/WebKit2/ChangeLog (158959 => 158960)


--- branches/safari-537.73-branch/Source/WebKit2/ChangeLog	2013-11-08 22:48:22 UTC (rev 158959)
+++ branches/safari-537.73-branch/Source/WebKit2/ChangeLog	2013-11-08 23:10:46 UTC (rev 158960)
@@ -1,3 +1,26 @@
+2013-11-08  Matt Hanson  <[email protected]>
+
+        Merge r158101.
+
+    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-11-08  Lucas Forschler  <[email protected]>
 
         Merge r157137

Modified: branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebContext.cpp (158959 => 158960)


--- branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebContext.cpp	2013-11-08 22:48:22 UTC (rev 158959)
+++ branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebContext.cpp	2013-11-08 23:10:46 UTC (rev 158960)
@@ -413,26 +413,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: branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebContext.h (158959 => 158960)


--- branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebContext.h	2013-11-08 22:48:22 UTC (rev 158959)
+++ branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebContext.h	2013-11-08 23:10:46 UTC (rev 158960)
@@ -379,6 +379,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: branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebIconDatabase.cpp (158959 => 158960)


--- branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2013-11-08 22:48:22 UTC (rev 158959)
+++ branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2013-11-08 23:10:46 UTC (rev 158960)
@@ -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();
@@ -292,4 +298,10 @@
     didChangeIconForPageURL(pageURL);
 }
 
+void WebIconDatabase::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
+{
+    if (m_iconDatabaseImpl)
+        m_iconDatabaseImpl->setPrivateBrowsingEnabled(privateBrowsingEnabled);
+}
+
 } // namespace WebKit

Modified: branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebIconDatabase.h (158959 => 158960)


--- branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebIconDatabase.h	2013-11-08 22:48:22 UTC (rev 158959)
+++ branches/safari-537.73-branch/Source/WebKit2/UIProcess/WebIconDatabase.h	2013-11-08 23:10:46 UTC (rev 158960)
@@ -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