Bug 166392 - [iOS] Background assertion not taken if Web process crashes while loading and the navigation delegate initiates a new load from under -webViewWebContentProcessDidTerminate:
Summary: [iOS] Background assertion not taken if Web process crashes while loading and...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-12-21 14:01 PST by mitz
Modified: 2017-02-03 23:40 PST (History)
2 users (show)

See Also:


Attachments
testcase that doesn't repro (9.22 KB, patch)
2017-02-03 18:28 PST, Tim Horton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2016-12-21 14:01:02 PST
When a web view is loading and its Web Content process crashes, if the navigation delegate initiates a new load from -webViewWebContentProcessDidTerminate:, then the PageLoadingState’s isLoading() never transitions to false. As a result, NavigationState::didChangeIsLoading doesn’t get called, and as a result of that, we fail to obtain an activity token for the new process, and as a result, the process may fail to receive a background assertion (if the web view is offscreen) and will fail to start the load.
Comment 1 mitz 2016-12-21 14:49:04 PST
<rdar://problem/29778369>
Comment 2 Tim Horton 2017-02-03 18:28:42 PST
Created attachment 300586 [details]
testcase that doesn't repro
Comment 3 mitz 2017-02-03 19:32:38 PST
Comment on attachment 300586 [details]
testcase that doesn't repro

View in context: https://bugs.webkit.org/attachment.cgi?id=300586&action=review

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NavigateInsideCrashCallback.mm:84
> +    [webView loadRequest:request];
> +    TestWebKitAPI::Util::run(&didFinishNavigation);
> +
> +    [webView _killWebContentProcess];

This appears to cause the crash after the web view is no longer loading, so it is not reproducing the conditions in the description of the bug.
Comment 4 Tim Horton 2017-02-03 23:40:57 PST
(In reply to comment #3)
> Comment on attachment 300586 [details]
> testcase that doesn't repro
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=300586&action=review
> 
> > Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NavigateInsideCrashCallback.mm:84
> > +    [webView loadRequest:request];
> > +    TestWebKitAPI::Util::run(&didFinishNavigation);
> > +
> > +    [webView _killWebContentProcess];
> 
> This appears to cause the crash after the web view is no longer loading, so
> it is not reproducing the conditions in the description of the bug.

Ahhhh, I misread that part! Thank you.