<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Cocoa] ASSERTION FAILED: response.url().protocolIsInHTTPFamily() in WebCore::computeFreshnessLifetimeForHTTPFamily() during a redirect with a custom NSURLProtocol"
   href="https://bugs.webkit.org/show_bug.cgi?id=147870">147870</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Cocoa] ASSERTION FAILED: response.url().protocolIsInHTTPFamily() in WebCore::computeFreshnessLifetimeForHTTPFamily() during a redirect with a custom NSURLProtocol
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Page Loading
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aestes&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=258708" name="attach_258708" title="test Xcode project">attachment 258708</a> <a href="attachment.cgi?id=258708&amp;action=edit" title="test Xcode project">[details]</a></span>
test Xcode project

NSURLProtocols can be used with WebView and UIWebView to load content from custom protocols. These protocols have the ability to generate redirects by calling -URLProtocol:wasRedirectedToRequest:redirectResponse: on their NSURLProtocolClient. The following assertion failure occurs when this is done in a debug build of WebKit:

ASSERTION FAILED: response.url().protocolIsInHTTPFamily()
/Users/estes/Repos/OpenSource/Source/WebCore/platform/network/CacheValidation.cpp(110) : std::chrono::microseconds WebCore::computeFreshnessLifetimeForHTTPFamily(const WebCore::ResourceResponse &amp;, std::chrono::system_clock::time_point)
1   0x111743780 WTFCrash
2   0x1131d5e93 WebCore::computeFreshnessLifetimeForHTTPFamily(WebCore::ResourceResponse const&amp;, std::__1::chrono::time_point&lt;std::__1::chrono::system_clock, std::__1::chrono::duration&lt;long long, std::__1::ratio&lt;1l, 1000000l&gt; &gt; &gt;)
3   0x1131d6aa1 WebCore::updateRedirectChainStatus(WebCore::RedirectChainCacheStatus&amp;, WebCore::ResourceResponse const&amp;)
4   0x1131b4baa WebCore::CachedResource::redirectReceived(WebCore::ResourceRequest&amp;, WebCore::ResourceResponse const&amp;)
5   0x1131b0439 WebCore::CachedRawResource::redirectReceived(WebCore::ResourceRequest&amp;, WebCore::ResourceResponse const&amp;)
6   0x114e66a16 WebCore::SubresourceLoader::willSendRequestInternal(WebCore::ResourceRequest&amp;, WebCore::ResourceResponse const&amp;)
7   0x114b3ee21 WebCore::ResourceLoader::willSendRequest(WebCore::ResourceHandle*, WebCore::ResourceRequest&amp;, WebCore::ResourceResponse const&amp;)
8   0x114b39472 WebCore::ResourceHandle::willSendRequest(WebCore::ResourceRequest&amp;, WebCore::ResourceResponse const&amp;)
9   0x115134833 -[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]
10  0x7fff920aa7b9 invocation function for block in _NSURLConnectionWillSendRequest(_CFURLConnection*, _CFURLRequest const*, _CFURLResponse*, void const*)
11  0x7fff920a28c2 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke
12  0x7fff920a273e -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
13  0x7fff920a2643 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:]
14  0x7fff920aa6ee _NSURLConnectionWillSendRequest(_CFURLConnection*, _CFURLRequest const*, _CFURLResponse*, void const*)
15  0x7fff92180ea3 invocation function for block in URLConnectionClient_Classic::_delegate_willSendRequestForRedirection(NSURLRequest const*, _CFURLResponse*, void (NSURLRequest const*) block_pointer)
16  0x7fff921806eb invocation function for block in URLConnectionClient_Classic::_withDelegateAsync(char const*, void (_CFURLConnection*, CFURLConnectionClientCurrent_VMax const*) block_pointer)
17  0x7fff90f5e409 _dispatch_client_callout
18  0x7fff90f749f8 _dispatch_block_invoke
19  0x7fff91ffc9c0 RunloopBlockContext::_invoke_block(void const*, void*)
20  0x7fff8ab5d154 CFArrayApplyFunction
21  0x7fff91ffc8b9 RunloopBlockContext::perform()
22  0x7fff91ffc690 MultiplexerSource::perform()
23  0x7fff91ffc4b2 MultiplexerSource::_perform(void*)
24  0x7fff8ab90e31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
25  0x7fff8ab82c5c __CFRunLoopDoSources0
26  0x7fff8ab8217f __CFRunLoopRun
27  0x7fff8ab81b78 CFRunLoopRunSpecific
28  0x7fff8b5f93e5 RunCurrentEventLoopInMode
29  0x7fff8b5f917b ReceiveNextEventCommon
30  0x7fff8b5f8fbb _BlockUntilNextEventMatchingListInModeWithFilter
31  0x7fff83eb9ae7 _DPSNextEvent

Attached is an Xcode project that reproduces this failure.</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>