diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 15:57:39 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 15:57:39 +0000 |
commit | eb6b87abf7962a109beb197cbabf46fb6baf1028 (patch) | |
tree | 25d7b2a3f613d89154bbc8b9d8134d9e3958177e /chrome/renderer/render_view.cc | |
parent | 4f48e5f82280a06f10134c34a2e4d217c3b8ce7c (diff) | |
download | chromium_src-eb6b87abf7962a109beb197cbabf46fb6baf1028.zip chromium_src-eb6b87abf7962a109beb197cbabf46fb6baf1028.tar.gz chromium_src-eb6b87abf7962a109beb197cbabf46fb6baf1028.tar.bz2 |
Fix a race condition where rapid back/forward clicks could close a tab
This can be triggered when you're on the new tab page, going to *two* other
sites, then rapidly hitting back and forward randomly. If a cross-site
transition was canceled before the original page responds with an "OK to close
me" message, it will mistakenly categorize the close as not just for the
RenderView (correspondong to one side of the cross-site transition) but for the
entire tab.
This change adds an explicit parameter on the messages indicating whether it's
for interstials or for the tab so we don't have to rely on the request still
being active.
This also adds the "requesting process + route" in addition to the
"new process + request" so we can be more clear about sending the messages to
the correct place. The previous patch conbimed these in a confusing way.
BUG=16246
TEST=none
Review URL: http://codereview.chromium.org/159255
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r-- | chrome/renderer/render_view.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index a2a37e1..f41e007 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2736,8 +2736,7 @@ void RenderView::OnMsgShouldClose() { Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); } -void RenderView::OnClosePage(int new_render_process_host_id, - int new_request_id) { +void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { // TODO(creis): We'd rather use webview()->Close() here, but that currently // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs // in the onunload handler from appearing. For now, we're bypassing that and @@ -2751,14 +2750,13 @@ void RenderView::OnClosePage(int new_render_process_host_id, // TODO(davemoore) this code should be removed once WillCloseFrame() gets // called when a page is destroyed. DumpLoadHistograms() is safe to call // multiple times for the same frame, but it will simplify things. - if (url.SchemeIs("http") || url.SchemeIs("https")) + if (url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme)) DumpLoadHistograms(); main_frame->ClosePage(); } - Send(new ViewHostMsg_ClosePage_ACK(routing_id_, - new_render_process_host_id, - new_request_id)); + // Just echo back the params in the ACK. + Send(new ViewHostMsg_ClosePage_ACK(routing_id_, params)); } void RenderView::OnThemeChanged() { |