Title: [197362] trunk/Source/WebKit2
- Revision
- 197362
- Author
- achristen...@apple.com
- Date
- 2016-02-29 12:46:13 -0800 (Mon, 29 Feb 2016)
Log Message
Don't call NetworkProcess::singleton from WebProcess when using NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=154829
Reviewed by Anders Carlsson.
We were calling NetworkProcess::singleton when making the default session in the
WebProcess, which caused bad things to happen. We also were never clearing the
credentials in the WebProcess between tests because it used to always call
NetworkProcess::singleton, which caused flaky tests.
This fixes repeatable crashes in http/tests/media/media-document-referer.html and
http/tests/media/media-document.html when using NetworkSession.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
(WebKit::NetworkProcess::~NetworkProcess):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::configurationForType):
(WebKit::globalCustomProtocolManager):
(WebKit::NetworkSession::setCustomProtocolManager):
(WebKit::NetworkSession::defaultSession):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::clearCachedCredentials):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (197361 => 197362)
--- trunk/Source/WebKit2/ChangeLog 2016-02-29 19:35:17 UTC (rev 197361)
+++ trunk/Source/WebKit2/ChangeLog 2016-02-29 20:46:13 UTC (rev 197362)
@@ -1,3 +1,30 @@
+2016-02-29 Alex Christensen <achristen...@webkit.org>
+
+ Don't call NetworkProcess::singleton from WebProcess when using NetworkSession
+ https://bugs.webkit.org/show_bug.cgi?id=154829
+
+ Reviewed by Anders Carlsson.
+
+ We were calling NetworkProcess::singleton when making the default session in the
+ WebProcess, which caused bad things to happen. We also were never clearing the
+ credentials in the WebProcess between tests because it used to always call
+ NetworkProcess::singleton, which caused flaky tests.
+
+ This fixes repeatable crashes in http/tests/media/media-document-referer.html and
+ http/tests/media/media-document.html when using NetworkSession.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::NetworkProcess):
+ (WebKit::NetworkProcess::~NetworkProcess):
+ * NetworkProcess/NetworkSession.h:
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::configurationForType):
+ (WebKit::globalCustomProtocolManager):
+ (WebKit::NetworkSession::setCustomProtocolManager):
+ (WebKit::NetworkSession::defaultSession):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::clearCachedCredentials):
+
2016-02-29 Gavin Barraclough <barraclo...@apple.com>
RefCounter<T>::Event -> RefCounterEvent
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (197361 => 197362)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2016-02-29 19:35:17 UTC (rev 197361)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2016-02-29 20:46:13 UTC (rev 197362)
@@ -96,6 +96,9 @@
addSupplement<AuthenticationManager>();
addSupplement<WebCookieManager>();
addSupplement<CustomProtocolManager>();
+#if USE(NETWORK_SESSION)
+ NetworkSession::setCustomProtocolManager(supplement<CustomProtocolManager>());
+#endif
}
NetworkProcess::~NetworkProcess()
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkSession.h (197361 => 197362)
--- trunk/Source/WebKit2/NetworkProcess/NetworkSession.h 2016-02-29 19:35:17 UTC (rev 197361)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkSession.h 2016-02-29 20:46:13 UTC (rev 197362)
@@ -53,6 +53,7 @@
NetworkSession(Type, WebCore::SessionID, CustomProtocolManager*);
~NetworkSession();
+ static void setCustomProtocolManager(CustomProtocolManager*);
static NetworkSession& defaultSession();
void clearCredentials();
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (197361 => 197362)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-02-29 19:35:17 UTC (rev 197361)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-02-29 20:46:13 UTC (rev 197362)
@@ -216,10 +216,21 @@
}
}
+static RefPtr<CustomProtocolManager>& globalCustomProtocolManager()
+{
+ NeverDestroyed<RefPtr<CustomProtocolManager>> gCustomProtocolManager;
+ return gCustomProtocolManager.get();
+}
+
+void NetworkSession::setCustomProtocolManager(CustomProtocolManager* customProtocolManager)
+{
+ globalCustomProtocolManager() = customProtocolManager;
+}
+
NetworkSession& NetworkSession::defaultSession()
{
ASSERT(isMainThread());
- static NeverDestroyed<NetworkSession> session(NetworkSession::Type::Normal, WebCore::SessionID::defaultSessionID(), NetworkProcess::singleton().supplement<CustomProtocolManager>());
+ static NeverDestroyed<NetworkSession> session(NetworkSession::Type::Normal, WebCore::SessionID::defaultSessionID(), globalCustomProtocolManager().get());
return session;
}
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (197361 => 197362)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-02-29 19:35:17 UTC (rev 197361)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-02-29 20:46:13 UTC (rev 197362)
@@ -500,6 +500,9 @@
void WebProcess::clearCachedCredentials()
{
NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
+#if USE(NETWORK_SESSION)
+ NetworkSession::defaultSession().clearCredentials();
+#endif
}
WebPage* WebProcess::focusedWebPage() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes