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

Side by Side Diff: content/browser/renderer_host/render_view_host.cc

Issue 6627063: Ignore JavaScript messages (alert/confirm/prompt) during unload handlers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added a browsertest Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_view_host.h" 5 #include "content/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 void RenderViewHost::OnMsgSelectionChanged(const std::string& text) { 1198 void RenderViewHost::OnMsgSelectionChanged(const std::string& text) {
1199 if (view()) 1199 if (view())
1200 view()->SelectionChanged(text); 1200 view()->SelectionChanged(text);
1201 } 1201 }
1202 1202
1203 void RenderViewHost::OnMsgRunJavaScriptMessage( 1203 void RenderViewHost::OnMsgRunJavaScriptMessage(
1204 const std::wstring& message, 1204 const std::wstring& message,
1205 const std::wstring& default_prompt, 1205 const std::wstring& default_prompt,
1206 const GURL& frame_url, 1206 const GURL& frame_url,
1207 const int flags, 1207 const int flags,
1208 const bool unload_handler_being_run,
1208 IPC::Message* reply_msg) { 1209 IPC::Message* reply_msg) {
1209 // While a JS message dialog is showing, tabs in the same process shouldn't 1210 // While a JS message dialog is showing, tabs in the same process shouldn't
1210 // process input events. 1211 // process input events.
1211 process()->set_ignore_input_events(true); 1212 process()->set_ignore_input_events(true);
1212 StopHangMonitorTimeout(); 1213 StopHangMonitorTimeout();
1213 delegate_->RunJavaScriptMessage(message, default_prompt, frame_url, flags, 1214 delegate_->RunJavaScriptMessage(message, default_prompt, frame_url, flags,
1214 reply_msg, 1215 unload_handler_being_run, reply_msg,
1215 &are_javascript_messages_suppressed_); 1216 &are_javascript_messages_suppressed_);
1216 } 1217 }
1217 1218
1218 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, 1219 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url,
1219 const std::wstring& message, 1220 const std::wstring& message,
1220 IPC::Message* reply_msg) { 1221 IPC::Message* reply_msg) {
1221 // While a JS before unload dialog is showing, tabs in the same process 1222 // While a JS before unload dialog is showing, tabs in the same process
1222 // shouldn't process input events. 1223 // shouldn't process input events.
1223 process()->set_ignore_input_events(true); 1224 process()->set_ignore_input_events(true);
1224 StopHangMonitorTimeout(); 1225 StopHangMonitorTimeout();
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 LOG(DFATAL) << "Invalid checked state " << checked_state; 1689 LOG(DFATAL) << "Invalid checked state " << checked_state;
1689 return; 1690 return;
1690 } 1691 }
1691 1692
1692 CommandState state; 1693 CommandState state;
1693 state.is_enabled = is_enabled; 1694 state.is_enabled = is_enabled;
1694 state.checked_state = 1695 state.checked_state =
1695 static_cast<RenderViewCommandCheckedState>(checked_state); 1696 static_cast<RenderViewCommandCheckedState>(checked_state);
1696 command_states_[static_cast<RenderViewCommand>(command)] = state; 1697 command_states_[static_cast<RenderViewCommand>(command)] = state;
1697 } 1698 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host.h ('k') | content/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698