diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 17:59:23 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 17:59:23 +0000 |
commit | e5c75e4861b7b84ffd18149ecc11934aaa159f21 (patch) | |
tree | e8db0d59bf55d5b01e4465e1881a8c3cdc71559b /chrome/renderer | |
parent | 8a9adb85620f16df0c223992c8a51bc3d3537158 (diff) | |
download | chromium_src-e5c75e4861b7b84ffd18149ecc11934aaa159f21.zip chromium_src-e5c75e4861b7b84ffd18149ecc11934aaa159f21.tar.gz chromium_src-e5c75e4861b7b84ffd18149ecc11934aaa159f21.tar.bz2 |
Make JavaScript alerts reflect the URL of the frame they came from, not the
enclosing frame.
BUG=1686837
Review URL: http://codereview.chromium.org/39163
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 16 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 9 |
2 files changed, 15 insertions, 10 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index debff4dc..ac29d7e 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1660,42 +1660,46 @@ class MessageBoxView { }; #endif -void RenderView::RunJavaScriptAlert(WebView* webview, +void RenderView::RunJavaScriptAlert(WebFrame* webframe, const std::wstring& message) { RunJavaScriptMessage(MessageBoxView::kIsJavascriptAlert, message, std::wstring(), + webframe->GetURL(), NULL); } -bool RenderView::RunJavaScriptConfirm(WebView* webview, +bool RenderView::RunJavaScriptConfirm(WebFrame* webframe, const std::wstring& message) { return RunJavaScriptMessage(MessageBoxView::kIsJavascriptConfirm, message, std::wstring(), + webframe->GetURL(), NULL); } -bool RenderView::RunJavaScriptPrompt(WebView* webview, +bool RenderView::RunJavaScriptPrompt(WebFrame* webframe, const std::wstring& message, const std::wstring& default_value, std::wstring* result) { return RunJavaScriptMessage(MessageBoxView::kIsJavascriptPrompt, message, default_value, + webframe->GetURL(), result); } bool RenderView::RunJavaScriptMessage(int type, const std::wstring& message, const std::wstring& default_value, + const GURL& frame_url, std::wstring* result) { bool success = false; std::wstring result_temp; if (!result) result = &result_temp; IPC::SyncMessage* msg = new ViewHostMsg_RunJavaScriptMessage( - routing_id_, message, default_value, type, &success, result); + routing_id_, message, default_value, frame_url, type, &success, result); msg->set_pump_messages_event(modal_dialog_event_.get()); Send(msg); @@ -1709,14 +1713,14 @@ void RenderView::AddGURLSearchProvider(const GURL& osd_url, bool autodetected) { autodetected)); } -bool RenderView::RunBeforeUnloadConfirm(WebView* webview, +bool RenderView::RunBeforeUnloadConfirm(WebFrame* webframe, const std::wstring& message) { bool success = false; // This is an ignored return value, but is included so we can accept the same // response as RunJavaScriptMessage. std::wstring ignored_result; IPC::SyncMessage* msg = new ViewHostMsg_RunBeforeUnloadConfirm( - routing_id_, message, &success, &ignored_result); + routing_id_, webframe->GetURL(), message, &success, &ignored_result); msg->set_pump_messages_event(modal_dialog_event_.get()); Send(msg); diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 1c0078c..700faa9 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -142,15 +142,15 @@ class RenderView : public RenderWidget, virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, const std::string& json_arguments, std::string* json_retval); - virtual void RunJavaScriptAlert(WebView* webview, + virtual void RunJavaScriptAlert(WebFrame* webframe, const std::wstring& message); - virtual bool RunJavaScriptConfirm(WebView* webview, + virtual bool RunJavaScriptConfirm(WebFrame* webframe, const std::wstring& message); - virtual bool RunJavaScriptPrompt(WebView* webview, + virtual bool RunJavaScriptPrompt(WebFrame* webframe, const std::wstring& message, const std::wstring& default_value, std::wstring* result); - virtual bool RunBeforeUnloadConfirm(WebView* webview, + virtual bool RunBeforeUnloadConfirm(WebFrame* webframe, const std::wstring& message); virtual void EnableSuddenTermination(); virtual void DisableSuddenTermination(); @@ -430,6 +430,7 @@ class RenderView : public RenderWidget, bool RunJavaScriptMessage(int type, const std::wstring& message, const std::wstring& default_value, + const GURL& frame_url, std::wstring* result); // Adds search provider from the given OpenSearch description URL as a |