- Revision
- 196384
- Author
- achristen...@apple.com
- Date
- 2016-02-10 12:56:11 -0800 (Wed, 10 Feb 2016)
Log Message
Fix assertions when loading from WebProcess
https://bugs.webkit.org/show_bug.cgi?id=154079
Reviewed by Anders Carlsson.
Assertions were failing, mostly when using NetworkProcess, and mostly involving Top Sites.
When we do loading from the WebProcess (which we should eventually not allow), we were sometimes
using a private browsing session that did not exist because the UIProcess had told the NetworkProcess
to create a private browsing session with the given SessionID, but the WebProcess was not told about
the private browsing session.
Also, sometimes we were calling NetworkProcess::singleton() from the WebProcess, which caused problems
with the PlatformStrategies object being reset. This prevents that, too.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::NetworkLoad):
Added an assertion that we have a network session when we have just made a NetworkingContext with the given SessionID.
* NetworkProcess/NetworkSession.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSession::defaultSession):
(WebKit::NetworkSession::NetworkSession):
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
Call NetworkProcess::singleton only when we know we are in the network process.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
(WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
Tell the WebProcesses about the new private session, too. Sometimes they use the new private session.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensurePrivateBrowsingSession):
(WebKit::WebProcess::destroyPrivateBrowsingSession):
Removed useless macros that were always true for all WK2 clients.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (196383 => 196384)
--- trunk/Source/WebKit2/ChangeLog 2016-02-10 20:47:04 UTC (rev 196383)
+++ trunk/Source/WebKit2/ChangeLog 2016-02-10 20:56:11 UTC (rev 196384)
@@ -1,3 +1,38 @@
+2016-02-10 Alex Christensen <achristen...@webkit.org>
+
+ Fix assertions when loading from WebProcess
+ https://bugs.webkit.org/show_bug.cgi?id=154079
+
+ Reviewed by Anders Carlsson.
+
+ Assertions were failing, mostly when using NetworkProcess, and mostly involving Top Sites.
+ When we do loading from the WebProcess (which we should eventually not allow), we were sometimes
+ using a private browsing session that did not exist because the UIProcess had told the NetworkProcess
+ to create a private browsing session with the given SessionID, but the WebProcess was not told about
+ the private browsing session.
+ Also, sometimes we were calling NetworkProcess::singleton() from the WebProcess, which caused problems
+ with the PlatformStrategies object being reset. This prevents that, too.
+
+ * NetworkProcess/NetworkLoad.cpp:
+ (WebKit::NetworkLoad::NetworkLoad):
+ Added an assertion that we have a network session when we have just made a NetworkingContext with the given SessionID.
+ * NetworkProcess/NetworkSession.h:
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::NetworkSession::defaultSession):
+ (WebKit::NetworkSession::NetworkSession):
+ * NetworkProcess/mac/RemoteNetworkingContext.mm:
+ (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
+ Call NetworkProcess::singleton only when we know we are in the network process.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+ (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+ Tell the WebProcesses about the new private session, too. Sometimes they use the new private session.
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::ensurePrivateBrowsingSession):
+ (WebKit::WebProcess::destroyPrivateBrowsingSession):
+ Removed useless macros that were always true for all WK2 clients.
+
2016-02-10 Dan Bernstein <m...@apple.com>
[Mac] Stop installing the legacy processes
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp (196383 => 196384)
--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp 2016-02-10 20:47:04 UTC (rev 196383)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp 2016-02-10 20:56:11 UTC (rev 196384)
@@ -59,6 +59,7 @@
} else
ASSERT_NOT_REACHED();
#else
+ ASSERT(SessionTracker::storageSession(parameters.sessionID));
m_handle = ResourceHandle::create(m_networkingContext.get(), parameters.request, this, parameters.defersLoading, parameters.contentSniffingPolicy == SniffContent);
#endif
}
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkSession.h (196383 => 196384)
--- trunk/Source/WebKit2/NetworkProcess/NetworkSession.h 2016-02-10 20:47:04 UTC (rev 196383)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkSession.h 2016-02-10 20:56:11 UTC (rev 196384)
@@ -41,6 +41,8 @@
namespace WebKit {
+class CustomProtocolManager;
+
class NetworkSession {
friend class NetworkDataTask;
public:
@@ -48,7 +50,7 @@
Normal,
Ephemeral
};
- NetworkSession(Type, WebCore::SessionID);
+ NetworkSession(Type, WebCore::SessionID, CustomProtocolManager*);
~NetworkSession();
static NetworkSession& defaultSession();
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (196383 => 196384)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-02-10 20:47:04 UTC (rev 196383)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-02-10 20:56:11 UTC (rev 196384)
@@ -210,17 +210,17 @@
NetworkSession& NetworkSession::defaultSession()
{
ASSERT(isMainThread());
- static NeverDestroyed<NetworkSession> session(NetworkSession::Type::Normal, WebCore::SessionID::defaultSessionID());
+ static NeverDestroyed<NetworkSession> session(NetworkSession::Type::Normal, WebCore::SessionID::defaultSessionID(), NetworkProcess::singleton().supplement<CustomProtocolManager>());
return session;
}
-NetworkSession::NetworkSession(Type type, WebCore::SessionID sessionID)
+NetworkSession::NetworkSession(Type type, WebCore::SessionID sessionID, CustomProtocolManager* customProtocolManager)
{
m_sessionDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this]);
NSURLSessionConfiguration *configuration = configurationForType(type);
- if (auto* customProtocolManager = NetworkProcess::singleton().supplement<CustomProtocolManager>())
+ if (customProtocolManager)
customProtocolManager->registerProtocolClass(configuration);
#if HAVE(TIMINGDATAOPTIONS)
Modified: trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm (196383 => 196384)
--- trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm 2016-02-10 20:47:04 UTC (rev 196383)
+++ trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm 2016-02-10 20:56:11 UTC (rev 196384)
@@ -26,6 +26,7 @@
#import "config.h"
#import "RemoteNetworkingContext.h"
+#import "CustomProtocolManager.h"
#import "NetworkProcess.h"
#import "NetworkSession.h"
#import "SessionTracker.h"
@@ -101,7 +102,7 @@
SessionTracker::setSession(sessionID, NetworkStorageSession::createPrivateBrowsingSession(base + '.' + String::number(sessionID.sessionID()))
#if USE(NETWORK_SESSION)
- , std::make_unique<NetworkSession>(NetworkSession::Type::Ephemeral, sessionID)
+ , std::make_unique<NetworkSession>(NetworkSession::Type::Ephemeral, sessionID, NetworkProcess::singleton().supplement<CustomProtocolManager>())
#endif
);
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (196383 => 196384)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-02-10 20:47:04 UTC (rev 196383)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-02-10 20:56:11 UTC (rev 196384)
@@ -481,8 +481,10 @@
m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this);
- if (m_sessionID.isEphemeral())
+ if (m_sessionID.isEphemeral()) {
m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::EnsurePrivateBrowsingSession(m_sessionID));
+ m_process->processPool().sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession(m_sessionID));
+ }
#if PLATFORM(COCOA)
const CFIndex viewStateChangeRunLoopOrder = (CFIndex)RunLoopObserver::WellKnownRunLoopOrders::CoreAnimationCommit - 1;
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm (196383 => 196384)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm 2016-02-10 20:47:04 UTC (rev 196383)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm 2016-02-10 20:56:11 UTC (rev 196384)
@@ -60,7 +60,7 @@
SessionTracker::setSession(sessionID, NetworkStorageSession::createPrivateBrowsingSession(base + '.' + String::number(sessionID.sessionID()))
#if USE(NETWORK_SESSION)
- , std::make_unique<NetworkSession>(NetworkSession::Type::Ephemeral, sessionID)
+ , std::make_unique<NetworkSession>(NetworkSession::Type::Ephemeral, sessionID, nullptr)
#endif
);
}
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (196383 => 196384)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-02-10 20:47:04 UTC (rev 196383)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-02-10 20:56:11 UTC (rev 196384)
@@ -468,16 +468,12 @@
void WebProcess::ensurePrivateBrowsingSession(SessionID sessionID)
{
-#if PLATFORM(COCOA) || USE(CFNETWORK) || USE(SOUP)
WebFrameNetworkingContext::ensurePrivateBrowsingSession(sessionID);
-#endif
}
void WebProcess::destroyPrivateBrowsingSession(SessionID sessionID)
{
-#if PLATFORM(COCOA) || USE(CFNETWORK) || USE(SOUP)
SessionTracker::destroySession(sessionID);
-#endif
}
#if ENABLE(NETSCAPE_PLUGIN_API)