Bug 142893

Summary: [WK2] We should allow stale content when restoring a killed / crashed WebProcess
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, barraclough, beidson, commit-queue, ddkilzer, japhet, kling, koivisto
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 142910, 142911    
Bug Blocks: 142916    
Attachments:
Description Flags
Patch none

Description Chris Dumez 2015-03-19 20:03:40 PDT
We should allow stale content when restoring a killed / crashed WebProcess (similarly to a history navigation). This is actually what was intended as we call WebPage::goToBackForwardItem() in this case, which uses FrameLoadType::IndexedBackForward load type. However, this value is then ignored in FrameLoader::loadDifferentDocumentItem() because m_stateMachine.committedFirstRealDocumentLoad() return false in this case. This means we end up doing fresh loads from the network in this case.

We just need to take care of the fact that we should still load fresh content when restoring the session state (<rdar://problem/8131355>) as this is why FrameLoader::loadDifferentDocumentItem() was ignoring the IndexedBackForward load type in the first place.

Radar: <rdar://problem/19633737> / <rdar://problem/19869257>
Comment 1 Chris Dumez 2015-03-19 21:06:59 PDT
Created attachment 249080 [details]
Patch
Comment 2 Antti Koivisto 2015-03-19 21:59:57 PDT
Comment on attachment 249080 [details]
Patch

No way to test this?
Comment 3 WebKit Commit Bot 2015-03-19 22:46:16 PDT
Comment on attachment 249080 [details]
Patch

Clearing flags on attachment: 249080

Committed r181782: <http://trac.webkit.org/changeset/181782>
Comment 4 WebKit Commit Bot 2015-03-19 22:46:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 David Kilzer (:ddkilzer) 2015-03-20 03:57:22 PDT
This caused a TestWebKitAPI test (WebKit2.RestoreSessionStateContainingFormData) to ASSERT:

<https://build.webkit.org/builders/Apple%20Yosemite%20Debug%20WK2%20%28Tests%29/builds/2922>

ASSERTION FAILED: isBackForwardLoadType(m_loadType)
/Volumes/Data/slave/yosemite-debug/build/Source/WebCore/loader/FrameLoader.cpp(3257) : void WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad()
1   0x10f1e5270 WTFCrash
2   0x11112db3c WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad()
3   0x110e18db3 WebCore::DocumentLoader::notifyFinished(WebCore::CachedResource*)
4   0x110a59172 WebCore::CachedResource::checkNotify()
5   0x110a59321 WebCore::CachedResource::error(WebCore::CachedResource::Status)
6   0x112612479 WebCore::SubresourceLoader::didFail(WebCore::ResourceError const&)
7   0x1122e9b45 WebCore::ResourceLoader::didFail(WebCore::ResourceHandle*, WebCore::ResourceError const&)
8   0x1128c1ad3 -[WebCoreResourceHandleAsDelegate connection:didFailWithError:]
9   0x7fff9178f20d __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke
10  0x7fff9178f1b1 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
11  0x7fff9178f356 -[NSURLConnectionInternal _withConnectionAndDelegate:]
12  0x7fff9177599b _NSURLConnectionDidFail(_CFURLConnection*, __CFError*, void const*)
13  0x7fff9172b51c invocation function for block in URLConnectionClient_Classic::_delegate_didFail(__CFError*, void () block_pointer)
14  0x7fff91729283 invocation function for block in URLConnectionClient_Classic::_withDelegateAsync(char const*, void (_CFURLConnection*, CFURLConnectionClientCurrent_VMax const*) block_pointer)
15  0x7fff9164b33c RunloopBlockContext::_invoke_block(void const*, void*)
16  0x7fff85fc6274 CFArrayApplyFunction
17  0x7fff9164b1fd RunloopBlockContext::perform()
18  0x7fff9164b09e MultiplexerSource::perform()
19  0x7fff9164aec0 MultiplexerSource::_perform(void*)
20  0x7fff85ffa681 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
21  0x7fff85fec80d __CFRunLoopDoSources0
22  0x7fff85febe3f __CFRunLoopRun
23  0x7fff85feb858 CFRunLoopRunSpecific
24  0x7fff88f1aaef RunCurrentEventLoopInMode
25  0x7fff88f1a86a ReceiveNextEventCommon
26  0x7fff88f1a6ab _BlockUntilNextEventMatchingListInModeWithFilter
27  0x7fff91aa6f81 _DPSNextEvent
28  0x7fff91aa6730 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
29  0x7fff91a9a593 -[NSApplication run]
30  0x7fff91a85a14 NSApplicationMain
31  0x7fff8ca27ef2 _xpc_objc_main
TIMEOUT WebKit2.RestoreSessionStateContainingFormData
Comment 6 WebKit Commit Bot 2015-03-20 08:06:17 PDT
Re-opened since this is blocked by bug 142910
Comment 7 Chris Dumez 2015-03-20 08:34:02 PDT
(In reply to comment #5)
> This caused a TestWebKitAPI test
> (WebKit2.RestoreSessionStateContainingFormData) to ASSERT:
> 
> <https://build.webkit.org/builders/
> Apple%20Yosemite%20Debug%20WK2%20%28Tests%29/builds/2922>
> 
> ASSERTION FAILED: isBackForwardLoadType(m_loadType)
> /Volumes/Data/slave/yosemite-debug/build/Source/WebCore/loader/FrameLoader.
> cpp(3257) : void
> WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad()
> 1   0x10f1e5270 WTFCrash
> 2   0x11112db3c
> WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad()
> 3   0x110e18db3
> WebCore::DocumentLoader::notifyFinished(WebCore::CachedResource*)
> 4   0x110a59172 WebCore::CachedResource::checkNotify()
> 5   0x110a59321
> WebCore::CachedResource::error(WebCore::CachedResource::Status)
> 6   0x112612479 WebCore::SubresourceLoader::didFail(WebCore::ResourceError
> const&)
> 7   0x1122e9b45 WebCore::ResourceLoader::didFail(WebCore::ResourceHandle*,
> WebCore::ResourceError const&)
> 8   0x1128c1ad3 -[WebCoreResourceHandleAsDelegate
> connection:didFailWithError:]
> 9   0x7fff9178f20d __65-[NSURLConnectionInternal
> _withConnectionAndDelegate:onlyActive:]_block_invoke
> 10  0x7fff9178f1b1 -[NSURLConnectionInternal
> _withConnectionAndDelegate:onlyActive:]
> 11  0x7fff9178f356 -[NSURLConnectionInternal _withConnectionAndDelegate:]
> 12  0x7fff9177599b _NSURLConnectionDidFail(_CFURLConnection*, __CFError*,
> void const*)
> 13  0x7fff9172b51c invocation function for block in
> URLConnectionClient_Classic::_delegate_didFail(__CFError*, void ()
> block_pointer)
> 14  0x7fff91729283 invocation function for block in
> URLConnectionClient_Classic::_withDelegateAsync(char const*, void
> (_CFURLConnection*, CFURLConnectionClientCurrent_VMax const*) block_pointer)
> 15  0x7fff9164b33c RunloopBlockContext::_invoke_block(void const*, void*)
> 16  0x7fff85fc6274 CFArrayApplyFunction
> 17  0x7fff9164b1fd RunloopBlockContext::perform()
> 18  0x7fff9164b09e MultiplexerSource::perform()
> 19  0x7fff9164aec0 MultiplexerSource::_perform(void*)
> 20  0x7fff85ffa681 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
> 21  0x7fff85fec80d __CFRunLoopDoSources0
> 22  0x7fff85febe3f __CFRunLoopRun
> 23  0x7fff85feb858 CFRunLoopRunSpecific
> 24  0x7fff88f1aaef RunCurrentEventLoopInMode
> 25  0x7fff88f1a86a ReceiveNextEventCommon
> 26  0x7fff88f1a6ab _BlockUntilNextEventMatchingListInModeWithFilter
> 27  0x7fff91aa6f81 _DPSNextEvent
> 28  0x7fff91aa6730 -[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:]
> 29  0x7fff91a9a593 -[NSApplication run]
> 30  0x7fff91a85a14 NSApplicationMain
> 31  0x7fff8ca27ef2 _xpc_objc_main
> TIMEOUT WebKit2.RestoreSessionStateContainingFormData

Ok, looking now.