Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1138)

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2655433002: Execute BeforeUnload on subframe browser-initiated navigations (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index a53ed812aa0d9c2123e134f75450943badf7238d..4f6c272bab922baf64c8e769f4b4cb842c5cd22f 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1659,17 +1659,18 @@ void RenderFrameImpl::SetPendingNavigationParams(
void RenderFrameImpl::OnBeforeUnload(bool is_reload) {
TRACE_EVENT1("navigation,rail", "RenderFrameImpl::OnBeforeUnload",
"id", routing_id_);
- // TODO(creis): Right now, this is only called on the main frame. Make the
- // browser process send dispatchBeforeUnloadEvent to every frame that needs
- // it.
- CHECK(!frame_->parent());
-
// Save the routing_id, as the RenderFrameImpl can be deleted in
// dispatchBeforeUnloadEvent. See https://crbug.com/666714 for details.
int routing_id = routing_id_;
base::TimeTicks before_unload_start_time = base::TimeTicks::Now();
+
+ // TODO(clamy): Ensure BeforeUnload is dispatched to all subframes, even when
+ // --site-per-process is enabled. |dispatchBeforeUnloadEvent| will only
+ // execute the BeforeUnload event in this frame and local child frames. It
+ // should also be dispatched to out-of-process child frames.
bool proceed = frame_->dispatchBeforeUnloadEvent(is_reload);
+
base::TimeTicks before_unload_end_time = base::TimeTicks::Now();
RenderThread::Get()->Send(new FrameHostMsg_BeforeUnload_ACK(
routing_id, proceed, before_unload_start_time, before_unload_end_time));

Powered by Google App Engine
This is Rietveld 408576698