diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-13 16:38:44 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-13 16:38:44 +0000 |
commit | 6a8f51186bb732bbeb40ef39eb87fb2ba7d882bb (patch) | |
tree | bb8b588a1acfa026ebb96a2d193301f892daa1b1 /content/renderer | |
parent | c802bc33b52d0332f1897461348781795d3dcb13 (diff) | |
download | chromium_src-6a8f51186bb732bbeb40ef39eb87fb2ba7d882bb.zip chromium_src-6a8f51186bb732bbeb40ef39eb87fb2ba7d882bb.tar.gz chromium_src-6a8f51186bb732bbeb40ef39eb87fb2ba7d882bb.tar.bz2 |
Fixes race condition in displaying error pages. In particular it was
possible for an error page to be shown after another load, resulting
in cancelling the other load. Here's the sequence that can trigger it:
. load page that results in error page (eg http://cnn.co), in RVH1.
. trigger loading of error page
. load correct page (eg http://cnn.com) in RVH2. This triggers a stop
in RVH1.
. error page finishes loading. Navigation completes, notifies browser
and browser swaps back to RVH1.
BUG=79515
TEST=none
R=jamesr@chromium.org
Review URL: http://codereview.chromium.org/7004024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85280 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/render_view.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 25c3763..0125947 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -299,6 +299,16 @@ static bool WebAccessibilityNotificationToViewHostMsg( return true; } +// If |data_source| is non-null and has a NavigationState associated with it, +// the AltErrorPageResourceFetcher is reset. +static void StopAltErrorPageFetcher(WebDataSource* data_source) { + if (data_source) { + NavigationState* state = NavigationState::FromDataSource(data_source); + if (state) + state->set_alt_error_page_fetcher(NULL); + } +} + /////////////////////////////////////////////////////////////////////////////// int32 RenderView::next_page_id_ = 1; @@ -792,8 +802,15 @@ void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { // Stop loading the current page void RenderView::OnStop() { - if (webview()) - webview()->mainFrame()->stopLoading(); + if (webview()) { + WebFrame* main_frame = webview()->mainFrame(); + // Stop the alt error page fetcher. If we let it continue it may complete + // and cause RenderViewHostManager to swap to this RenderView, even though + // it may no longer be active. + StopAltErrorPageFetcher(main_frame->provisionalDataSource()); + StopAltErrorPageFetcher(main_frame->dataSource()); + main_frame->stopLoading(); + } } // Reload current focused frame. |