Modified: trunk/Source/WebCore/ChangeLog (233182 => 233183)
--- trunk/Source/WebCore/ChangeLog 2018-06-25 23:54:25 UTC (rev 233182)
+++ trunk/Source/WebCore/ChangeLog 2018-06-25 23:56:01 UTC (rev 233183)
@@ -1,3 +1,23 @@
+2018-06-25 Brady Eidson <beid...@apple.com>
+
+ Remove RELEASE_ASSERT added in r230875.
+ <rdar://problem/40860061> and https://bugs.webkit.org/show_bug.cgi?id=187022
+
+ Reviewed by Brent Fulgham.
+
+ There's actually more than one way for a network session to be destroyed, and that can happen
+ asynchronously and unpredictably.
+
+ And the request to start up a WebSocket and do its handshake is also asynchronous and unpredictable
+
+ It's an expected race.
+
+ If the NetworkStorageSession cannot be found then the WebSocket handshake should just fail.
+
+ * platform/network/SocketStreamHandleImpl.cpp:
+ (WebCore::cookieDataForHandshake): If the NetworkStorageSession cannot be found, return std::nullopt.
+ (WebCore::SocketStreamHandleImpl::platformSendHandshake): If the cookieData is null, fail the handshake.
+
2018-06-25 Wenson Hsieh <wenson_hs...@apple.com>
[iPad apps on macOS] Web process crashes when attempting to play embedded YouTube video in News
Modified: trunk/Source/WebCore/platform/network/SocketStreamHandleImpl.cpp (233182 => 233183)
--- trunk/Source/WebCore/platform/network/SocketStreamHandleImpl.cpp 2018-06-25 23:54:25 UTC (rev 233182)
+++ trunk/Source/WebCore/platform/network/SocketStreamHandleImpl.cpp 2018-06-25 23:56:01 UTC (rev 233183)
@@ -77,16 +77,17 @@
return dataLength - 2;
}
-static std::pair<Vector<uint8_t>, bool> cookieDataForHandshake(const CookieRequestHeaderFieldProxy& headerFieldProxy)
+static std::optional<std::pair<Vector<uint8_t>, bool>> cookieDataForHandshake(const CookieRequestHeaderFieldProxy& headerFieldProxy)
{
auto networkStorageSession = NetworkStorageSession::storageSession(headerFieldProxy.sessionID);
- RELEASE_ASSERT(networkStorageSession);
-
+ if (!networkStorageSession)
+ return std::nullopt;
+
String cookieDataString;
bool secureCookiesAccessed = false;
std::tie(cookieDataString, secureCookiesAccessed) = WebCore::cookieRequestHeaderFieldValue(*networkStorageSession, headerFieldProxy);
if (cookieDataString.isEmpty())
- return { { }, secureCookiesAccessed };
+ return std::pair<Vector<uint8_t>, bool> { { }, secureCookiesAccessed };
CString cookieData = cookieDataString.utf8();
@@ -94,7 +95,7 @@
data.append(cookieData.data(), cookieData.length());
data.appendVector(Vector<uint8_t>({ '\r', '\n', '\r', '\n' }));
- return { data, secureCookiesAccessed };
+ return std::pair<Vector<uint8_t>, bool> { data, secureCookiesAccessed };
}
void SocketStreamHandleImpl::platformSendHandshake(const uint8_t* data, size_t length, const std::optional<CookieRequestHeaderFieldProxy>& headerFieldProxy, Function<void(bool, bool)>&& completionHandler)
@@ -103,7 +104,13 @@
bool secureCookiesAccessed = false;
if (headerFieldProxy) {
- std::tie(cookieData, secureCookiesAccessed) = cookieDataForHandshake(headerFieldProxy.value());
+ auto cookieDataFromNetworkSession = cookieDataForHandshake(headerFieldProxy.value());
+ if (!cookieDataFromNetworkSession) {
+ completionHandler(false, false);
+ return;
+ }
+
+ std::tie(cookieData, secureCookiesAccessed) = *cookieDataFromNetworkSession;
if (cookieData.size())
length = removeTerminationCharacters(data, length);
}