summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornasko@chromium.org <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-23 01:01:13 +0000
committernasko@chromium.org <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-23 01:01:13 +0000
commitf0969571f00c5eb1e594f8fcd537043c03961624 (patch)
tree55b1fec2280580f039944a65d2e5155a5df3c076
parent28013f71f52eb0d7bcbb825f93359eb7c4c57640 (diff)
downloadchromium_src-f0969571f00c5eb1e594f8fcd537043c03961624.zip
chromium_src-f0969571f00c5eb1e594f8fcd537043c03961624.tar.gz
chromium_src-f0969571f00c5eb1e594f8fcd537043c03961624.tar.bz2
Simulate beforeunload for subframes.
In order to navigate subframes cross-origin, we need to either run the beforeunload handler or skip it. The current behavior is to CHECK, which prevents us from making progress. This CL skips running the handler for subframes and allows the navigation to proceed. BUG=357747 Review URL: https://codereview.chromium.org/247023003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265454 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/frame_host/render_frame_host_impl.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index ab507b1..ddda5a6 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -522,9 +522,13 @@ void RenderFrameHostImpl::OnBeforeUnloadACK(
bool proceed,
const base::TimeTicks& renderer_before_unload_start_time,
const base::TimeTicks& renderer_before_unload_end_time) {
- // TODO(creis): Support beforeunload on subframes.
+ // TODO(creis): Support properly beforeunload on subframes. For now just
+ // pretend that the handler ran and allowed the navigation to proceed.
if (GetParent()) {
- NOTREACHED() << "Should only receive BeforeUnload_ACK from the main frame.";
+ render_view_host_->is_waiting_for_beforeunload_ack_ = false;
+ frame_tree_node_->render_manager()->OnBeforeUnloadACK(
+ render_view_host_->unload_ack_is_for_cross_site_transition_, proceed,
+ renderer_before_unload_end_time);
return;
}
@@ -750,9 +754,7 @@ void RenderFrameHostImpl::NavigateToURL(const GURL& url) {
void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) {
// TODO(creis): Support subframes.
- DCHECK(!GetParent());
-
- if (!render_view_host_->IsRenderViewLive()) {
+ if (!render_view_host_->IsRenderViewLive() || GetParent()) {
// We don't have a live renderer, so just skip running beforeunload.
render_view_host_->is_waiting_for_beforeunload_ack_ = true;
render_view_host_->unload_ack_is_for_cross_site_transition_ =