Changeset 169460 in webkit


Ignore:
Timestamp:
May 29, 2014, 1:01:27 PM (11 years ago)
Author:
mitz@apple.com
Message:

[Cocoa] Can’t recover from subframe load errors
https://bugs.webkit.org/show_bug.cgi?id=133385

Reviewed by Anders Carlsson.

  • UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.
  • UIProcess/Cocoa/NavigationState.h: Added flag in m_navigationDelegateMethods struct.
  • UIProcess/Cocoa/NavigationState.mm:

(WebKit::NavigationState::setNavigationDelegate): Initialize
webViewNavigationDidFailProvisionalLoadInSubframeWithError flag in the delegate methods
struct.
(WebKit::NavigationState::LoaderClient::didFailProvisionalLoadWithErrorForFrame): If the
error occurred in a subframe, invoke the new delegate method.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r169458 r169460  
     12014-05-29  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] Can’t recover from subframe load errors
     4        https://bugs.webkit.org/show_bug.cgi?id=133385
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.
     9        * UIProcess/Cocoa/NavigationState.h: Added flag in m_navigationDelegateMethods struct.
     10        * UIProcess/Cocoa/NavigationState.mm:
     11        (WebKit::NavigationState::setNavigationDelegate): Initialize
     12        webViewNavigationDidFailProvisionalLoadInSubframeWithError flag in the delegate methods
     13        struct.
     14        (WebKit::NavigationState::LoaderClient::didFailProvisionalLoadWithErrorForFrame): If the
     15        error occurred in a subframe, invoke the new delegate method.
     16
    1172014-05-29  Geoffrey Garen  <ggaren@apple.com>
    218
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h

    r168541 r169460  
    2525
    2626#import <WebKit/WKNavigationDelegate.h>
     27
     28#import <WebKit/WKFrameInfo.h>
    2729#import <WebKit/WKWebViewPrivate.h>
    2830
     
    3638
    3739@optional
     40
     41- (void)_webView:(WKWebView *)webView navigation:(WKNavigation *)navigation didFailProvisionalLoadInSubframe:(WKFrameInfo *)subframe withError:(NSError *)error;
    3842
    3943- (void)_webView:(WKWebView *)webView navigationDidFinishDocumentLoad:(WKNavigation *)navigation;
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h

    r169016 r169460  
    138138        bool webViewDidReceiveServerRedirectForProvisionalNavigation : 1;
    139139        bool webViewDidFailProvisionalNavigationWithError : 1;
     140        bool webViewNavigationDidFailProvisionalLoadInSubframeWithError : 1;
    140141        bool webViewDidCommitNavigation : 1;
    141142        bool webViewNavigationDidFinishDocumentLoad : 1;
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

    r169016 r169460  
    124124    m_navigationDelegateMethods.webViewDidFailNavigationWithError = [delegate respondsToSelector:@selector(webView:didFailNavigation:withError:)];
    125125
     126    m_navigationDelegateMethods.webViewNavigationDidFailProvisionalLoadInSubframeWithError = [delegate respondsToSelector:@selector(_webView:navigation:didFailProvisionalLoadInSubframe:withError:)];
    126127    m_navigationDelegateMethods.webViewNavigationDidFinishDocumentLoad = [delegate respondsToSelector:@selector(_webView:navigationDidFinishDocumentLoad:)];
    127128    m_navigationDelegateMethods.webViewRenderingProgressDidChange = [delegate respondsToSelector:@selector(_webView:renderingProgressDidChange:)];
     
    432433void NavigationState::LoaderClient::didFailProvisionalLoadWithErrorForFrame(WebPageProxy*, WebFrameProxy* webFrameProxy, uint64_t navigationID, const WebCore::ResourceError& error, API::Object*)
    433434{
    434     if (!webFrameProxy->isMainFrame())
    435         return;
     435    if (!webFrameProxy->isMainFrame()) {
     436        if (!m_navigationState.m_navigationDelegateMethods.webViewNavigationDidFailProvisionalLoadInSubframeWithError)
     437            return;
     438
     439        auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
     440        auto errorWithRecoveryAttempter = createErrorWithRecoveryAttempter(m_navigationState.m_webView, *webFrameProxy, error);
     441        // FIXME: Get the main frame's current navigation.
     442        [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView navigation:nil didFailProvisionalLoadInSubframe:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*webFrameProxy]).get() withError:errorWithRecoveryAttempter.get()];
     443
     444        return;
     445    }
    436446
    437447    // FIXME: We should assert that navigationID is not zero here, but it's currently zero for navigations originating from the web process.
Note: See TracChangeset for help on using the changeset viewer.