Diff
Modified: trunk/Source/WebCore/ChangeLog (206731 => 206732)
--- trunk/Source/WebCore/ChangeLog 2016-10-03 10:32:52 UTC (rev 206731)
+++ trunk/Source/WebCore/ChangeLog 2016-10-03 10:42:11 UTC (rev 206732)
@@ -1,5 +1,31 @@
2016-10-03 Carlos Garcia Campos <[email protected]>
+ [SOUP] Simplify AuthenticationChallenge
+ https://bugs.webkit.org/show_bug.cgi?id=162784
+
+ Reviewed by Alex Christensen.
+
+ We don't really need to keep references to the SoupSession and SoupMessage in AuthenticationChallenge, the
+ SoupNetworkSession callback already forwards the challenge to the right ResourceHandle.
+
+ * platform/network/soup/AuthenticationChallenge.h:
+ (WebCore::AuthenticationChallenge::authenticationClient):
+ (WebCore::AuthenticationChallenge::soupSession): Deleted.
+ (WebCore::AuthenticationChallenge::soupMessage): Deleted.
+ * platform/network/soup/AuthenticationChallengeSoup.cpp:
+ (WebCore::AuthenticationChallenge::AuthenticationChallenge):
+ (WebCore::AuthenticationChallenge::platformCompare):
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
+ (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+ (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
+ (WebCore::ResourceHandle::receivedCredential):
+ (WebCore::ResourceHandle::receivedCancellation):
+ * platform/network/soup/SoupNetworkSession.cpp:
+ (WebCore::authenticateCallback):
+
+2016-10-03 Carlos Garcia Campos <[email protected]>
+
[SOUP] Cleanup persistent credential storage code
https://bugs.webkit.org/show_bug.cgi?id=162777
Modified: trunk/Source/WebCore/platform/network/soup/AuthenticationChallenge.h (206731 => 206732)
--- trunk/Source/WebCore/platform/network/soup/AuthenticationChallenge.h 2016-10-03 10:32:52 UTC (rev 206731)
+++ trunk/Source/WebCore/platform/network/soup/AuthenticationChallenge.h 2016-10-03 10:42:11 UTC (rev 206732)
@@ -44,10 +44,8 @@
{
}
- AuthenticationChallenge(SoupSession*, SoupMessage*, SoupAuth*, bool retrying, AuthenticationClient*);
+ AuthenticationChallenge(SoupMessage*, SoupAuth*, bool retrying, AuthenticationClient* = nullptr);
AuthenticationClient* authenticationClient() const { return m_authenticationClient.get(); }
- SoupSession* soupSession() const { return m_soupSession.get(); }
- SoupMessage* soupMessage() const { return m_soupMessage.get(); }
SoupAuth* soupAuth() const { return m_soupAuth.get(); }
void setProposedCredential(const Credential& credential) { m_proposedCredential = credential; }
@@ -55,8 +53,6 @@
friend class AuthenticationChallengeBase;
static bool platformCompare(const AuthenticationChallenge&, const AuthenticationChallenge&);
- GRefPtr<SoupSession> m_soupSession;
- GRefPtr<SoupMessage> m_soupMessage;
GRefPtr<SoupAuth> m_soupAuth;
RefPtr<AuthenticationClient> m_authenticationClient;
};
Modified: trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp (206731 => 206732)
--- trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp 2016-10-03 10:32:52 UTC (rev 206731)
+++ trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp 2016-10-03 10:42:11 UTC (rev 206732)
@@ -66,14 +66,12 @@
String::fromUTF8(soup_auth_get_realm(soupAuth)), scheme);
}
-AuthenticationChallenge::AuthenticationChallenge(SoupSession* soupSession, SoupMessage* soupMessage, SoupAuth* soupAuth, bool retrying, AuthenticationClient* client)
+AuthenticationChallenge::AuthenticationChallenge(SoupMessage* soupMessage, SoupAuth* soupAuth, bool retrying, AuthenticationClient* client)
: AuthenticationChallengeBase(protectionSpaceFromSoupAuthAndMessage(soupAuth, soupMessage),
Credential(), // proposedCredentials
retrying ? 1 : 0, // previousFailureCount
soupMessage, // failureResponse
ResourceError::authenticationError(soupMessage))
- , m_soupSession(soupSession)
- , m_soupMessage(soupMessage)
, m_soupAuth(soupAuth)
, m_authenticationClient(client)
{
@@ -81,9 +79,7 @@
bool AuthenticationChallenge::platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
{
- return a.soupSession() == b.soupSession()
- && a.soupMessage() == b.soupMessage()
- && a.soupAuth() == b.soupAuth();
+ return a.soupAuth() == b.soupAuth();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (206731 => 206732)
--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2016-10-03 10:32:52 UTC (rev 206731)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2016-10-03 10:42:11 UTC (rev 206732)
@@ -969,19 +969,16 @@
ASSERT(!d->m_currentWebChallenge.isNull());
AuthenticationChallenge& challenge = d->m_currentWebChallenge;
- ASSERT(challenge.soupSession());
- ASSERT(challenge.soupMessage());
+ ASSERT(d->m_soupMessage);
if (!credentialFromPersistentStorage.isEmpty())
challenge.setProposedCredential(credentialFromPersistentStorage);
if (!client()) {
- soup_session_unpause_message(challenge.soupSession(), challenge.soupMessage());
+ soup_session_unpause_message(d->soupSession(), d->m_soupMessage.get());
clearAuthentication();
return;
}
- ASSERT(challenge.soupSession());
- ASSERT(challenge.soupMessage());
client()->didReceiveAuthenticationChallenge(this, challenge);
}
@@ -1015,7 +1012,7 @@
}
d->m_currentWebChallenge = challenge;
- soup_session_pause_message(challenge.soupSession(), challenge.soupMessage());
+ soup_session_pause_message(d->soupSession(), d->m_soupMessage.get());
// We could also do this before we even start the request, but that would be at the expense
// of all request latency, versus a one-time latency for the small subset of requests that
@@ -1036,7 +1033,7 @@
ASSERT(!challenge.isNull());
if (challenge != d->m_currentWebChallenge)
return;
- soup_session_unpause_message(challenge.soupSession(), challenge.soupMessage());
+ soup_session_unpause_message(d->soupSession(), d->m_soupMessage.get());
clearAuthentication();
}
@@ -1067,10 +1064,9 @@
}
}
- ASSERT(challenge.soupSession());
- ASSERT(challenge.soupMessage());
+ ASSERT(d->m_soupMessage);
soup_auth_authenticate(challenge.soupAuth(), credential.user().utf8().data(), credential.password().utf8().data());
- soup_session_unpause_message(challenge.soupSession(), challenge.soupMessage());
+ soup_session_unpause_message(d->soupSession(), d->m_soupMessage.get());
clearAuthentication();
}
@@ -1086,9 +1082,8 @@
return;
}
- ASSERT(challenge.soupSession());
- ASSERT(challenge.soupMessage());
- soup_session_unpause_message(challenge.soupSession(), challenge.soupMessage());
+ ASSERT(d->m_soupMessage);
+ soup_session_unpause_message(d->soupSession(), d->m_soupMessage.get());
if (client())
client()->receivedCancellation(this, challenge);
Modified: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp (206731 => 206732)
--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2016-10-03 10:32:52 UTC (rev 206731)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2016-10-03 10:42:11 UTC (rev 206732)
@@ -75,12 +75,12 @@
return std::unique_ptr<SoupNetworkSession>(new SoupNetworkSession(soupSession));
}
-static void authenticateCallback(SoupSession* session, SoupMessage* soupMessage, SoupAuth* soupAuth, gboolean retrying)
+static void authenticateCallback(SoupSession*, SoupMessage* soupMessage, SoupAuth* soupAuth, gboolean retrying)
{
RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));
if (!handle)
return;
- handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(session, soupMessage, soupAuth, retrying, handle.get()));
+ handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(soupMessage, soupAuth, retrying, handle.get()));
}
#if ENABLE(WEB_TIMING) && !SOUP_CHECK_VERSION(2, 49, 91)