Title: [158075] trunk/Source/WebKit2
Revision
158075
Author
[email protected]
Date
2013-10-25 17:29:17 -0700 (Fri, 25 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 Beth Dakin.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::willStartUsingPrivateBrowsing): Call setPrivateBrowsingEnabled(true) on each context.
(WebKit::WebContext::willStopUsingPrivateBrowsing): Call setPrivateBrowsingEnabled(false) on each context.
(WebKit::WebContext::setPrivateBrowsingEnabled): In addition to notifying other processes, notify WebIconDatabase.
* UIProcess/WebContext.h:

* UIProcess/WebIconDatabase.cpp:
(WebKit::WebIconDatabase::setPrivateBrowsingEnabled):
* UIProcess/WebIconDatabase.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (158074 => 158075)


--- trunk/Source/WebKit2/ChangeLog	2013-10-26 00:25:08 UTC (rev 158074)
+++ trunk/Source/WebKit2/ChangeLog	2013-10-26 00:29:17 UTC (rev 158075)
@@ -1,3 +1,20 @@
+2013-10-25  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 Beth Dakin.
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::willStartUsingPrivateBrowsing): Call setPrivateBrowsingEnabled(true) on each context.
+        (WebKit::WebContext::willStopUsingPrivateBrowsing): Call setPrivateBrowsingEnabled(false) on each context.
+        (WebKit::WebContext::setPrivateBrowsingEnabled): In addition to notifying other processes, notify WebIconDatabase.
+        * UIProcess/WebContext.h:
+
+        * UIProcess/WebIconDatabase.cpp:
+        (WebKit::WebIconDatabase::setPrivateBrowsingEnabled):
+        * UIProcess/WebIconDatabase.h:
+
 2013-10-25  Joseph Pecoraro  <[email protected]>
 
         Upstream ENABLE(REMOTE_INSPECTOR) and enable on iOS and Mac

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (158074 => 158075)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2013-10-26 00:25:08 UTC (rev 158074)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2013-10-26 00:29:17 UTC (rev 158075)
@@ -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]->setPrivateBrowsingEnabled(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]->setPrivateBrowsingEnabled(false);
+}
+
+void WebContext::setPrivateBrowsingEnabled(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 (158074 => 158075)


--- trunk/Source/WebKit2/UIProcess/WebContext.h	2013-10-26 00:25:08 UTC (rev 158074)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h	2013-10-26 00:29:17 UTC (rev 158075)
@@ -398,6 +398,8 @@
     void addPlugInAutoStartOriginHash(const String& pageOrigin, unsigned plugInOriginHash);
     void plugInDidReceiveUserInteraction(unsigned plugInOriginHash);
 
+    void setPrivateBrowsingEnabled(bool);
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
     // PluginInfoStoreClient:
     virtual void pluginInfoStoreDidLoadPlugins(PluginInfoStore*) OVERRIDE;

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp (158074 => 158075)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2013-10-26 00:25:08 UTC (rev 158074)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2013-10-26 00:29:17 UTC (rev 158075)
@@ -293,4 +293,9 @@
     didChangeIconForPageURL(pageURL);
 }
 
+void WebIconDatabase::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
+{
+    m_iconDatabaseImpl->setPrivateBrowsingEnabled(privateBrowsingEnabled);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.h (158074 => 158075)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.h	2013-10-26 00:25:08 UTC (rev 158074)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.h	2013-10-26 00:29:17 UTC (rev 158075)
@@ -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