Bug 147870 - [Cocoa] ASSERTION FAILED: response.url().protocolIsInHTTPFamily() in WebCore::computeFreshnessLifetimeForHTTPFamily() during a redirect with a custom NSURLProtocol
Summary: [Cocoa] ASSERTION FAILED: response.url().protocolIsInHTTPFamily() in WebCore:...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-10 23:51 PDT by Andy Estes
Modified: 2015-08-10 23:54 PDT (History)
3 users (show)

See Also:


Attachments
test Xcode project (34.55 KB, application/zip)
2015-08-10 23:51 PDT, Andy Estes
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Estes 2015-08-10 23:51:44 PDT
Created attachment 258708 [details]
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 &, std::chrono::system_clock::time_point)
1   0x111743780 WTFCrash
2   0x1131d5e93 WebCore::computeFreshnessLifetimeForHTTPFamily(WebCore::ResourceResponse const&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l> > >)
3   0x1131d6aa1 WebCore::updateRedirectChainStatus(WebCore::RedirectChainCacheStatus&, WebCore::ResourceResponse const&)
4   0x1131b4baa WebCore::CachedResource::redirectReceived(WebCore::ResourceRequest&, WebCore::ResourceResponse const&)
5   0x1131b0439 WebCore::CachedRawResource::redirectReceived(WebCore::ResourceRequest&, WebCore::ResourceResponse const&)
6   0x114e66a16 WebCore::SubresourceLoader::willSendRequestInternal(WebCore::ResourceRequest&, WebCore::ResourceResponse const&)
7   0x114b3ee21 WebCore::ResourceLoader::willSendRequest(WebCore::ResourceHandle*, WebCore::ResourceRequest&, WebCore::ResourceResponse const&)
8   0x114b39472 WebCore::ResourceHandle::willSendRequest(WebCore::ResourceRequest&, WebCore::ResourceResponse const&)
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.