<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&#64;igalia.com" title="Carlos Garcia Campos &lt;cgarcia&#64;igalia.com&gt;"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=292471&amp;action=diff" name="attach_292471" title="Patch to be applied after the main patch">attachment 292471</a> <a href="attachment.cgi?id=292471&amp;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&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=292471&amp;action=review</a>

<span class="quote">&gt; network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.h:64
&gt; +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">&gt; network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:-95
&gt; +    auto&amp; cocoaSession = reinterpret_cast&lt;NetworkSessionCocoa&amp;&gt;(m_session.get()); // downcast&lt;NetworkSessionCocoa&gt;(m_session.get());
&gt;      if (storedCredentials == WebCore::AllowStoredCredentials) {
&gt; -        m_task = [downcast&lt;NetworkSessionCocoa&gt;(m_session.get()).m_sessionWithCredentialStorage dataTaskWithRequest:nsRequest];
&gt; -        ASSERT(!downcast&lt;NetworkSessionCocoa&gt;(m_session.get()).m_dataTaskMapWithCredentials.contains([m_task taskIdentifier]));
&gt; -        downcast&lt;NetworkSessionCocoa&gt;(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">&gt; network_session/OpenSource/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm:463
&gt; -NetworkSessionCocoa::~NetworkSession()
&gt; +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>