diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 21:26:25 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 21:26:25 +0000 |
commit | e0749fddf70f0edfa7363ceda0156be0d3c72b7e (patch) | |
tree | b1e19709c4f5b195e1312ab8087f23242d96b833 /webkit | |
parent | cafe13b00a4318255986b9635ef47a84cf22e4a8 (diff) | |
download | chromium_src-e0749fddf70f0edfa7363ceda0156be0d3c72b7e.zip chromium_src-e0749fddf70f0edfa7363ceda0156be0d3c72b7e.tar.gz chromium_src-e0749fddf70f0edfa7363ceda0156be0d3c72b7e.tar.bz2 |
The WebURLResponse will be null if the network request fails. So, a null check
here is warranted. I failed to translate this over when adapting this code to
the new interfaces.
The tight coupling with WebView, WebFrame and WebViewDelegate makes this code
non-trivial to test. My next patch was anyways to remove those dependencies.
I'll circle around at that point with some unit tests for these classes.
R=brettw
TEST=none
BUG=16144
Review URL: http://codereview.chromium.org/155166
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20082 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/alt_404_page_resource_fetcher.cc | 3 | ||||
-rw-r--r-- | webkit/glue/alt_error_page_resource_fetcher.cc | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/webkit/glue/alt_404_page_resource_fetcher.cc b/webkit/glue/alt_404_page_resource_fetcher.cc index bc4a51d..df75414 100644 --- a/webkit/glue/alt_404_page_resource_fetcher.cc +++ b/webkit/glue/alt_404_page_resource_fetcher.cc @@ -42,7 +42,8 @@ Alt404PageResourceFetcher::Alt404PageResourceFetcher( void Alt404PageResourceFetcher::OnURLFetchComplete( const WebURLResponse& response, const std::string& data) { - if (response.httpStatusCode() == 200) { + // A null response indicates a network error. + if (!response.isNull() && response.httpStatusCode() == 200) { // Only show server response if we got a 200. webframeloaderclient_->Alt404PageFinished(doc_loader_.get(), data); } else { diff --git a/webkit/glue/alt_error_page_resource_fetcher.cc b/webkit/glue/alt_error_page_resource_fetcher.cc index 72783da..6645f59 100644 --- a/webkit/glue/alt_error_page_resource_fetcher.cc +++ b/webkit/glue/alt_error_page_resource_fetcher.cc @@ -53,7 +53,8 @@ void AltErrorPageResourceFetcher::OnURLFetchComplete( if (!delegate) return; - if (response.httpStatusCode() == 200) { + // A null response indicates a network error. + if (!response.isNull() && response.httpStatusCode() == 200) { // We successfully got a response from the alternate error page server, so // load it. delegate->LoadNavigationErrorPage(web_frame_, failed_request_, @@ -64,4 +65,4 @@ void AltErrorPageResourceFetcher::OnURLFetchComplete( } } -} // namespace webkit_glue
\ No newline at end of file +} // namespace webkit_glue |