[Cocoa] Add a way to recover from load errors
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Nov 2013 23:21:08 +0000 (23:21 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Nov 2013 23:21:08 +0000 (23:21 +0000)
commit56b2e0da6c40069ac9123a1cb3583d4d846ce7a7
tree51572705a488ffbcad9f7053d8c2e75138f273cf
parentfd28a616bd5a730508c003d01f23923288cd2eb2
[Cocoa] Add a way to recover from load errors
https://bugs.webkit.org/show_bug.cgi?id=125020

Reviewed by Sam Weinig.

* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(createErrorWithRecoveryAttempter): Added this helper function. It creates an NSError from
the given error, adding two keys to the user info dictionary: the context controller under
the recovery attempter key, and the frame under a private key.
(didFailProvisionalLoadWithErrorForFrame): Changed to use createErrorWithRecoveryAttempter.
(didFailLoadWithErrorForFrame): Ditto.
(-[WKBrowsingContextController attemptRecoveryFromError:]): Implemented this
WKErrorRecoveryAttempting protocol method by loading the failing URL from the error into the
frame from the error.

* UIProcess/API/Cocoa/WKErrorRecoveryAttempting.h: Added. Defines a protocol for attempting
recovery from errors and declares the error user info dictionary key under which an object
conforming to this protocol may be stored.
* UIProcess/API/Cocoa/WKErrorRecoveryAttempting.m: Added. Defines
WKRecoveryAttempterErrorKey.

* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::loadURL): Added. Sends the LoadURLInFrame message to the page.
* UIProcess/WebFrameProxy.h:

* WebKit2.xcodeproj/project.pbxproj: Added references to new files.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadURLInFrame): Added. Loads the URL in the given frame.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Added LoadURLInFrame.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm
Source/WebKit2/UIProcess/API/Cocoa/WKErrorRecoveryAttempting.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKErrorRecoveryAttempting.m [new file with mode: 0644]
Source/WebKit2/UIProcess/WebFrameProxy.cpp
Source/WebKit2/UIProcess/WebFrameProxy.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in