Index: content/browser/web_contents/render_view_host_manager.cc |
diff --git a/content/browser/web_contents/render_view_host_manager.cc b/content/browser/web_contents/render_view_host_manager.cc |
index 392b869af64a18ee574fea79df204ddd3b55d8d5..e22b0445116bdb80366f37d8e5cc3149b450577a 100644 |
--- a/content/browser/web_contents/render_view_host_manager.cc |
+++ b/content/browser/web_contents/render_view_host_manager.cc |
@@ -425,6 +425,11 @@ void RenderViewHostManager::SwapOutOldPage() { |
CHECK(cross_navigation_pending_ || pending_nav_params_.get()); |
// First close any modal dialogs that would prevent us from swapping out. |
+ // TODO(creis): This is not a guarantee. The renderer could immediately |
+ // create another dialog in a loop, potentially causing a renderer crash when |
+ // we tell it to swap out with a nested message loop and PageGroupLoadDeferrer |
+ // on the stack. We should prevent the renderer from showing more dialogs |
+ // until the SwapOut. See http://crbug.com/312490. |
delegate_->CancelModalDialogsForRenderManager(); |
// Tell the old renderer it is being swapped out. This will fire the unload |
@@ -755,6 +760,14 @@ void RenderViewHostManager::CommitPending() { |
// this triggers won't be able to figure out what's going on. |
bool will_focus_location_bar = delegate_->FocusLocationBarByDefault(); |
+ // We currently can't guarantee that the renderer isn't showing a new modal |
+ // dialog, even though we canceled them in SwapOutOldPage. (It may have |
+ // created another in the mean time.) Make sure we run and reset the callback |
darin (slow to review)
2013/10/29 16:57:23
nit: "mean time" -> "meantime"
Charlie Reis
2013/10/29 17:13:17
Done.
|
+ // now before we delete its RVH below. |
+ // TODO(creis): Remove this if we can guarantee that no new dialogs will be |
+ // shown after SwapOutOldPage. See http://crbug.com/312490. |
+ delegate_->CancelModalDialogsForRenderManager(); |
+ |
// Next commit the Web UI, if any. Either replace |web_ui_| with |
// |pending_web_ui_|, or clear |web_ui_| if there is no pending WebUI, or |
// leave |web_ui_| as is if reusing it. |