diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-02 19:23:45 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-02 19:23:45 +0000 |
commit | 15d79e12a0831ac527dc938297c14a386dcf5f0a (patch) | |
tree | 22c72b70cd8d4534433a1005b5e680c66eeb9463 /webkit/glue/webframe_impl.cc | |
parent | 30de967447ec9f048578cda8b22aba5fad2c68d8 (diff) | |
download | chromium_src-15d79e12a0831ac527dc938297c14a386dcf5f0a.zip chromium_src-15d79e12a0831ac527dc938297c14a386dcf5f0a.tar.gz chromium_src-15d79e12a0831ac527dc938297c14a386dcf5f0a.tar.bz2 |
Move alternate error page loading out of WebFrame.
Make the RenderView be in charge of loading alternate error pages.
While working on this change, I noticed several related bugs:
1- Loading an URL with an invalid host name from the new tab page results in
an error page. If you hit back and then forward, you will be left with an
empty location bar. In a debug build this trips an assertion in
ClassifyNavigation because the given page_id is -1. This problem is caused by
not duplicating the NavigationState of the failed load when creating a load for
the error page. Hence, the pending_page_id of the forward navigation is lost.
2- Loading an URL with an invalid host name as a subframe results in an extra
navigation in session history. One navigation for the main frame and one
navigation for the error page load. This is another symptom of the problem
described in #1. However, the solution is different. Here, we need to know
that the subframe load is an AUTO_SUBFRAME load so that we load the error page
using 'replace' semantics (so that WebCore does not generate a new session
history entry).
Finally, I decided to restrict alternative DNS error pages to only work for the
main frame to match what we do for alternative 404 error pages. It doesn't seem
worth it to show link doctor results for subframes since their primary purpose
is to assist people who mis-type an URL.
R=tony,brettw
BUG=15648
TEST=covered by errorpage_uitest.cc
Review URL: http://codereview.chromium.org/159575
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22253 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webframe_impl.cc')
-rw-r--r-- | webkit/glue/webframe_impl.cc | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index eed9443..3564e45 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -152,7 +152,6 @@ MSVC_POP_WARNING(); #include "webkit/api/public/WebScriptSource.h" #include "webkit/api/public/WebSize.h" #include "webkit/api/public/WebURLError.h" -#include "webkit/glue/alt_error_page_resource_fetcher.h" #include "webkit/glue/chrome_client_impl.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/dom_operations_private.h" @@ -604,6 +603,12 @@ void WebFrameImpl::StopLoading() { frame_->loader()->stopLoading(false); } +bool WebFrameImpl::IsLoading() const { + if (!frame_) + return false; + return frame_->loader()->isLoading(); +} + WebFrame* WebFrameImpl::GetOpener() const { if (frame_) { Frame* opener = frame_->loader()->opener(); @@ -1504,13 +1509,7 @@ void WebFrameImpl::Paint(skia::PlatformCanvas* canvas, const WebRect& rect) { } } -bool WebFrameImpl::IsLoading() { - // I'm assuming this does what we want. - return frame_->loader()->isLoading(); -} - void WebFrameImpl::Closing() { - alt_error_page_fetcher_.reset(); frame_ = NULL; } @@ -1528,11 +1527,6 @@ void WebFrameImpl::DidReceiveData(DocumentLoader* loader, // NOTE: mac only does this if there is a document frame_->loader()->addData(data, length); - - // It's possible that we get a DNS failure followed by a second load that - // succeeds before we hear back from the alternate error page server. In - // that case, cancel the alt error page download. - alt_error_page_fetcher_.reset(); } void WebFrameImpl::DidFail(const ResourceError& error, bool was_provisional) { @@ -1549,25 +1543,6 @@ void WebFrameImpl::DidFail(const ResourceError& error, bool was_provisional) { } } -void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebURLRequest& request, - const WebURLError& error, - const GURL& error_page_url, - bool replace, - const GURL& fake_url) { - // Load alternate HTML in place of the previous request. We use a fake_url - // for the Base URL. That prevents other web content from the same origin - // as the failed URL to script the error page. - - LoadHTMLString("", // Empty document - fake_url, - error.unreachableURL, - replace); - - alt_error_page_fetcher_.reset(new AltErrorPageResourceFetcher( - error_page_url, this, error.unreachableURL, - NewCallback(this, &WebFrameImpl::AltErrorPageFinished))); -} - void WebFrameImpl::DispatchWillSendRequest(WebURLRequest* request) { ResourceResponse response; frame_->loader()->client()->dispatchWillSendRequest(NULL, 0, @@ -1847,13 +1822,3 @@ void WebFrameImpl::LoadJavaScriptURL(const KURL& url) { frame_->loader()->end(); } } - -void WebFrameImpl::AltErrorPageFinished(const GURL& unreachable_url, - const std::string& html) { - WebViewDelegate* d = GetWebViewImpl()->delegate(); - if (!d) - return; - WebURLError error; - error.unreachableURL = unreachable_url; - d->LoadNavigationErrorPage(this, WebURLRequest(), error, html, true); -} |