Bug 144501

Summary: Back/forward navigation to an error page in Safari breaks the back-forward list
Product: WebKit Reporter: mitz
Component: WebKit2Assignee: mitz
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, beidson, commit-queue, japhet, sam, thorton
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Handle error page loads in the context of the provisional load error that triggered them darin: review+

Description mitz 2015-05-01 14:45:26 PDT
<rdar://problem/8636045>

To reproduce:

1. Make a new Safari empty window
2. Type a bogus address in the Smart Search Field (e.g. "http://bad.example") and hit Return to get a page-load error page
3. Type a real address in the Smart Search Field (e.g. "http://apple.com") and hit Return to visit the real page
4. click Back to go back to the error page

At this point the Back button should be disabled, and the Forward button should be enabled. But instead, the Back button is enabled, and the Forward button is disabled. Clicking and holding the Back button shows an extra “Failed to open page” item in the Back list. Clicking the Back button again doesn’t anything.
Comment 1 mitz 2015-05-01 14:46:57 PDT
The mechanism that is supposed to prevent this is FrameLoader::shouldReloadToHandleUnreachableURL. The special handling only kicks in if the error page is being loaded synchronously from beneath dispatchDidFailProvisionalLoad. That is not the case when using WebKit2, because dispatchDidFailProvisionalLoad returns immediately after sending a message to the UI process, and the latter later calls back to load the error page.

I am going to fix this by sending the necessary context along to the UI process and restoring it if and when we load the error page from within the UI’s process handling of the error.
Comment 2 mitz 2015-05-01 16:16:21 PDT
Created attachment 252188 [details]
Handle error page loads in the context of the provisional load error that triggered them
Comment 3 mitz 2015-05-01 16:48:31 PDT
Fixed in <http://trac.webkit.org/r183698>.