Changeset 133522 in webkit


Ignore:
Timestamp:
Nov 5, 2012 1:59:44 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Do not display error page for failed downloads
https://bugs.webkit.org/show_bug.cgi?id=101246

Internal PR: 236318
Internal reviewed by Joe Mason, Leo Yang.
Patch by Lianghui Chen <liachen@rim.com> on 2012-11-05
Reviewed by Rob Buis.

Right now when a main load, including all downloads, failed, it will
display an error page. This is not very user friendly, especially for
WebWorks application, which want to use its own user interface to info
user about the failure.
So we just stop displaying error page for downloads.

  • WebCoreSupport/FrameLoaderClientBlackBerry.cpp:

(WebCore::FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad):

Location:
trunk/Source/WebKit/blackberry
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/ChangeLog

    r133517 r133522  
     12012-11-05  Lianghui Chen  <liachen@rim.com>
     2
     3        [BlackBerry] Do not display error page for failed downloads
     4        https://bugs.webkit.org/show_bug.cgi?id=101246
     5
     6        Internal PR: 236318
     7        Internal reviewed by Joe Mason, Leo Yang.
     8        Reviewed by Rob Buis.
     9
     10        Right now when a main load, including all downloads, failed, it will
     11        display an error page. This is not very user friendly, especially for
     12        WebWorks application, which want to use its own user interface to info
     13        user about the failure.
     14        So we just stop displaying error page for downloads.
     15
     16        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
     17        (WebCore::FrameLoaderClientBlackBerry::dispatchDidFailProvisionalLoad):
     18
    1192012-11-05  Simon Fraser  <simon.fraser@apple.com>
    220
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

    r133199 r133522  
    710710        return;
    711711
    712     String errorPage = m_webPagePrivate->m_client->getErrorPage(error.errorCode(), error.localizedDescription(), error.failingURL());
    713 
    714712    // Make sure we're still in the provisionalLoad state - getErrorPage runs a
    715713    // nested event loop while it's waiting for client resources to load so
    716714    // there's a small window for the user to hit stop.
    717     if (m_frame->loader()->provisionalDocumentLoader()) {
    718         SubstituteData errorData(utf8Buffer(errorPage), "text/html", "utf-8", KURL(KURL(), error.failingURL()));
    719 
    720         ResourceRequest originalRequest = m_frame->loader()->provisionalDocumentLoader()->originalRequest();
    721 
    722         // Loading using SubstituteData will replace the original request with our
    723         // error data. This must be done within dispatchDidFailProvisionalLoad,
    724         // and do NOT call stopAllLoaders first, because the loader checks the
    725         // provisionalDocumentLoader to decide the load type; if called any other
    726         // way, the error page is added to the end of the history instead of
    727         // replacing the failed load.
    728         //
    729         // If this comes from a back/forward navigation, we need to save the current viewstate
    730         // to original historyitem, and prevent the restore of view state to the error page.
    731         if (isBackForwardLoadType(m_frame->loader()->loadType())) {
    732             m_frame->loader()->history()->saveScrollPositionAndViewStateToItem(m_frame->loader()->history()->currentItem());
    733             ASSERT(m_frame->loader()->history()->provisionalItem());
    734             m_frame->loader()->history()->provisionalItem()->viewState().shouldSaveViewState = false;
    735         }
    736         m_loadingErrorPage = true;
    737         m_frame->loader()->load(originalRequest, errorData, false);
    738     }
     715    if (!m_frame->loader()->provisionalDocumentLoader())
     716        return;
     717
     718    ResourceRequest originalRequest = m_frame->loader()->provisionalDocumentLoader()->originalRequest();
     719
     720    // Do not show error page for a failed download.
     721    if (originalRequest.forceDownload())
     722        return;
     723
     724    String errorPage = m_webPagePrivate->m_client->getErrorPage(error.errorCode(), error.localizedDescription(), error.failingURL());
     725    SubstituteData errorData(utf8Buffer(errorPage), "text/html", "utf-8", KURL(KURL(), error.failingURL()));
     726
     727    // Loading using SubstituteData will replace the original request with our
     728    // error data. This must be done within dispatchDidFailProvisionalLoad,
     729    // and do NOT call stopAllLoaders first, because the loader checks the
     730    // provisionalDocumentLoader to decide the load type; if called any other
     731    // way, the error page is added to the end of the history instead of
     732    // replacing the failed load.
     733    //
     734    // If this comes from a back/forward navigation, we need to save the current viewstate
     735    // to original historyitem, and prevent the restore of view state to the error page.
     736    if (isBackForwardLoadType(m_frame->loader()->loadType())) {
     737        m_frame->loader()->history()->saveScrollPositionAndViewStateToItem(m_frame->loader()->history()->currentItem());
     738        ASSERT(m_frame->loader()->history()->provisionalItem());
     739        m_frame->loader()->history()->provisionalItem()->viewState().shouldSaveViewState = false;
     740    }
     741
     742    m_loadingErrorPage = true;
     743    m_frame->loader()->load(originalRequest, errorData, false);
    739744}
    740745
Note: See TracChangeset for help on using the changeset viewer.