diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-27 20:15:40 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-27 20:15:40 +0000 |
commit | ae23c272faf85d4cf779ae15d28fc59f5a8162ab (patch) | |
tree | 8c409202170b3cb9866b98d6e89185ba036323cf /chrome/browser/renderer_host/render_view_host.h | |
parent | d138713180c3aea617f4c612deb164dfdb305751 (diff) | |
download | chromium_src-ae23c272faf85d4cf779ae15d28fc59f5a8162ab.zip chromium_src-ae23c272faf85d4cf779ae15d28fc59f5a8162ab.tar.gz chromium_src-ae23c272faf85d4cf779ae15d28fc59f5a8162ab.tar.bz2 |
Re-landing r21673 without re-enabling the BrowserTest, which apparently is
still failing.
Make downloads not prevent tabs from closing. If a download creates a
cross-site transition (for example, if you click a link in Gmail that results
in a download in a new tab), that tab will be stuck and you can't close it or
the browser. This is the opposite problem with a similar cause as bug 16246. In
both cases we were using some secondary signal to tell us if we're closing for
a cross site transition or closing the tab, and that signal was wrong. In this
case, we were running the onunload handler, but because there was a pending
RenderViewHost, the RenderManager would think that the close was a cross-site
one, and not forward the close message to actually close the tab. This patch
adds a flag to the on unload handlers that indicates whether it's for a tab
closure or a cross-site transition, so we can do the right thing unambiguously
when the message returns. In this case I keep this information in the
RenderView in case we send multiple close requests, we'll close the tab if any
of them were for the entire tab, even if that particular one was dropped
because we don't want to have more than one in flight at once. BUG=17560
TEST=none.
Review URL: http://codereview.chromium.org/160122
Review URL: http://codereview.chromium.org/159426
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21685 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/render_view_host.h')
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 6d196f4e..d0836bc 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -151,7 +151,11 @@ class RenderViewHost : public RenderWidgetHost, // Causes the renderer to invoke the onbeforeunload event handler. The // result will be returned via ViewMsg_ShouldClose. See also ClosePage which // will fire the PageUnload event. - void FirePageBeforeUnload(); + // + // Set bool for_cross_site_transition when this close is just for the current + // RenderView in the case of a cross-site transition. False means we're + // closing the entire tab. + void FirePageBeforeUnload(bool for_cross_site_transition); // Causes the renderer to close the current page, including running its // onunload event handler. A ClosePage_ACK message will be sent to the @@ -619,8 +623,17 @@ class RenderViewHost : public RenderWidgetHost, // must return to the renderer to unblock it. IPC::Message* run_modal_reply_msg_; + // Set to true when there is a pending ViewMsg_ShouldClose message pending. + // This ensures we don't spam the renderer many times to close. When true, + // the value of unload_ack_is_for_cross_site_transition_ indicates which type + // of unload this is for. bool is_waiting_for_unload_ack_; + // Valid only when is_waiting_for_unload_ack_ is true, this tells us if the + // unload request is for closing the entire tab ( = false), or only this + // RenderViewHost in the case of a cross-site transition ( = true). + bool unload_ack_is_for_cross_site_transition_; + bool are_javascript_messages_suppressed_; // True if the render view can be shut down suddenly. |