Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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:

Canonical link: https://commits.webkit.org/141477@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
beidson committed Oct 26, 2013
1 parent e77a429 commit 1d3e6ad
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 13 deletions.
17 changes: 17 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,20 @@
2013-10-25 Brady Eidson <beidson@apple.com>

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 <pecoraro@apple.com>

Upstream ENABLE(REMOTE_INSPECTOR) and enable on iOS and Mac
Expand Down
34 changes: 21 additions & 13 deletions Source/WebKit2/UIProcess/WebContext.cpp
Expand Up @@ -428,26 +428,34 @@ void WebContext::getDatabaseProcessConnection(PassRefPtr<Messages::WebProcessPro
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) {
#if ENABLE(NETWORK_PROCESS)
if (contexts[i]->usesNetworkProcess() && contexts[i]->networkProcess())
contexts[i]->networkProcess()->send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(), 0);
#endif
for (size_t i = 0, count = contexts.size(); i < count; ++i)
contexts[i]->setPrivateBrowsingEnabled(false);
}

contexts[i]->sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession());
void WebContext::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
{
m_iconDatabase->setPrivateBrowsingEnabled(privateBrowsingEnabled);

#if ENABLE(NETWORK_PROCESS)
if (usesNetworkProcess() && networkProcess()) {
if (privateBrowsingEnabled)
networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession(), 0);
else
networkProcess()->send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(), 0);
}
#endif // ENABLED(NETWORK_PROCESS)

if (privateBrowsingEnabled)
sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession());
else
sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession());
}

void (*s_invalidMessageCallback)(WKStringRef messageName);
Expand Down
2 changes: 2 additions & 0 deletions Source/WebKit2/UIProcess/WebContext.h
Expand Up @@ -398,6 +398,8 @@ class WebContext : public TypedAPIObject<APIObject::TypeContext>, private CoreIP
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;
Expand Down
5 changes: 5 additions & 0 deletions Source/WebKit2/UIProcess/WebIconDatabase.cpp
Expand Up @@ -293,4 +293,9 @@ void WebIconDatabase::notifyIconDataReadyForPageURL(const String& pageURL)
didChangeIconForPageURL(pageURL);
}

void WebIconDatabase::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
{
m_iconDatabaseImpl->setPrivateBrowsingEnabled(privateBrowsingEnabled);
}

} // namespace WebKit
2 changes: 2 additions & 0 deletions Source/WebKit2/UIProcess/WebIconDatabase.h
Expand Up @@ -87,6 +87,8 @@ class WebIconDatabase : public TypedAPIObject<APIObject::TypeIconDatabase>, publ

void initializeIconDatabaseClient(const WKIconDatabaseClient*);

void setPrivateBrowsingEnabled(bool);

private:
WebIconDatabase(WebContext*);

Expand Down

0 comments on commit 1d3e6ad

Please sign in to comment.