<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - NetworkSession: switch to use subclasses for NetworkSession and NetworkDataTask implementations"
href="https://bugs.webkit.org/show_bug.cgi?id=163777#c11">Comment # 11</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - NetworkSession: switch to use subclasses for NetworkSession and NetworkDataTask implementations"
href="https://bugs.webkit.org/show_bug.cgi?id=163777">bug 163777</a>
from <span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=292471&action=diff" name="attach_292471" title="Patch to be applied after the main patch">attachment 292471</a> <a href="attachment.cgi?id=292471&action=edit" title="Patch to be applied after the main patch">[details]</a></span>
Patch to be applied after the main patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=292471&action=review">https://bugs.webkit.org/attachment.cgi?id=292471&action=review</a>
<span class="quote">> network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.h:64
> +public:</span >
This is not correct, I think, the problem is that NetworkSessionCocoa is using NetworkDataTaskCocoa::suggestedFilename() directly, so the solution would be to cast there to use NetworkDataTask::suggestedFilename() instead. I think these overrides should remain private.
<span class="quote">> network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:-95
> + auto& cocoaSession = reinterpret_cast<NetworkSessionCocoa&>(m_session.get()); // downcast<NetworkSessionCocoa>(m_session.get());
> if (storedCredentials == WebCore::AllowStoredCredentials) {
> - m_task = [downcast<NetworkSessionCocoa>(m_session.get()).m_sessionWithCredentialStorage dataTaskWithRequest:nsRequest];
> - ASSERT(!downcast<NetworkSessionCocoa>(m_session.get()).m_dataTaskMapWithCredentials.contains([m_task taskIdentifier]));
> - downcast<NetworkSessionCocoa>(m_session.get()).m_dataTaskMapWithCredentials.add([m_task taskIdentifier], this);</span >
I don't know why it worked for Soup, though. I guess we need to either add type traits (adding a pure virtual type() or several isFoo() methods to NetworkSession) or simply use reinterpret_cast since here the network session should always be NetworkSessionCocoa.
<span class="quote">> network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm:463
> -NetworkSessionCocoa::~NetworkSession()
> +NetworkSessionCocoa::~NetworkSessionCocoa()</span >
Oops, I forgot this.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>