diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 17:41:40 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 17:41:40 +0000 |
commit | 5f45b5c09370ed31a5e114e409db308a4190e592 (patch) | |
tree | 76965315659d0e653b80f94c05fd64d1e42b5242 /content/browser | |
parent | 2f2679a718c53cf2cfcef0aaaf364e84d594ee95 (diff) | |
download | chromium_src-5f45b5c09370ed31a5e114e409db308a4190e592.zip chromium_src-5f45b5c09370ed31a5e114e409db308a4190e592.tar.gz chromium_src-5f45b5c09370ed31a5e114e409db308a4190e592.tar.bz2 |
Plumb user_gesture up from Blink to the JavaScript dialog code, and don't offer to suppress dialogs if they're initiated by a user gesture.
BUG=263192
TEST=as in bug
Review URL: https://chromiumcodereview.appspot.com/22909052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
9 files changed, 11 insertions, 3 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 96e60e1..bb92c9e 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -1549,6 +1549,7 @@ void BrowserPluginGuest::RunJavaScriptDialog( JavaScriptMessageType javascript_message_type, const string16& message_text, const string16& default_prompt_text, + bool user_gesture, const DialogClosedCallback& callback, bool* did_suppress_message) { if (permission_request_map_.size() >= kNumMaxOutstandingPermissionRequests) { diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index 74624ef..15d28d2 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -213,6 +213,7 @@ class CONTENT_EXPORT BrowserPluginGuest JavaScriptMessageType javascript_message_type, const string16& message_text, const string16& default_prompt_text, + bool user_gesture, const DialogClosedCallback& callback, bool* did_suppress_message) OVERRIDE; virtual void RunBeforeUnloadDialog( diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 21b22b3..5cb5172 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -262,6 +262,7 @@ class CONTENT_EXPORT RenderViewHostDelegate { const string16& default_prompt, const GURL& frame_url, JavaScriptMessageType type, + bool user_gesture, IPC::Message* reply_msg, bool* did_suppress_message) {} diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index d373e7d..d2be3e3 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -1435,13 +1435,14 @@ void RenderViewHostImpl::OnRunJavaScriptMessage( const string16& default_prompt, const GURL& frame_url, JavaScriptMessageType type, + bool user_gesture, IPC::Message* reply_msg) { // While a JS message dialog is showing, tabs in the same process shouldn't // process input events. GetProcess()->SetIgnoreInputEvents(true); StopHangMonitorTimeout(); delegate_->RunJavaScriptMessage(this, message, default_prompt, frame_url, - type, reply_msg, + type, user_gesture, reply_msg, &are_javascript_messages_suppressed_); } diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h index 94f2079..649d83a 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h @@ -539,6 +539,7 @@ class CONTENT_EXPORT RenderViewHostImpl const string16& default_prompt, const GURL& frame_url, JavaScriptMessageType type, + bool user_gesture, IPC::Message* reply_msg); void OnRunBeforeUnloadConfirm(const GURL& frame_url, const string16& message, diff --git a/content/browser/web_contents/render_view_host_manager_unittest.cc b/content/browser/web_contents/render_view_host_manager_unittest.cc index ea35e6b..77d6533 100644 --- a/content/browser/web_contents/render_view_host_manager_unittest.cc +++ b/content/browser/web_contents/render_view_host_manager_unittest.cc @@ -304,7 +304,7 @@ TEST_F(RenderViewHostManagerTest, FilterMessagesWhileSwappedOut) { ntp_process_host->sink().ClearMessages(); ViewHostMsg_RunJavaScriptMessage js_msg( rvh()->GetRoutingID(), msg, msg, kChromeURL, - JAVASCRIPT_MESSAGE_TYPE_CONFIRM, &result, &unused); + JAVASCRIPT_MESSAGE_TYPE_CONFIRM, false, &result, &unused); js_msg.EnableMessagePumping(); EXPECT_TRUE(ntp_rvh->OnMessageReceived(js_msg)); EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID)); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 5917a44..801084f 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -3356,6 +3356,7 @@ void WebContentsImpl::RunJavaScriptMessage( const string16& default_prompt, const GURL& frame_url, JavaScriptMessageType javascript_message_type, + bool user_gesture, IPC::Message* reply_msg, bool* did_suppress_message) { // Suppress JavaScript dialogs when requested. Also suppress messages when @@ -3379,6 +3380,7 @@ void WebContentsImpl::RunJavaScriptMessage( javascript_message_type, message, default_prompt, + user_gesture, base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), rvh, diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 55f377b..abc52e2 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -398,6 +398,7 @@ class CONTENT_EXPORT WebContentsImpl const string16& default_prompt, const GURL& frame_url, JavaScriptMessageType type, + bool user_gesture, IPC::Message* reply_msg, bool* did_suppress_message) OVERRIDE; virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh, diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index aded7ae..b20cf66 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -2014,7 +2014,7 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) { bool did_suppress_message = false; contents()->RunJavaScriptMessage(contents()->GetRenderViewHost(), ASCIIToUTF16("This is an informative message"), ASCIIToUTF16("OK"), - kGURL, JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, + kGURL, JAVASCRIPT_MESSAGE_TYPE_ALERT, false, dummy_message, &did_suppress_message); EXPECT_TRUE(did_suppress_message); } |