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 /webkit | |
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 'webkit')
-rw-r--r-- | webkit/glue/chrome_client_impl.cc | 13 | ||||
-rw-r--r-- | webkit/glue/webframe.h | 4 | ||||
-rw-r--r-- | webkit/glue/webview_delegate.h | 11 |
3 files changed, 15 insertions, 13 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index c9965dd..91af605 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -289,12 +289,13 @@ bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() { return webview_->delegate() != NULL; } -bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const WebCore::String& message, - WebCore::Frame* frame) { +bool ChromeClientImpl::runBeforeUnloadConfirmPanel( + const WebCore::String& message, + WebCore::Frame* frame) { WebViewDelegate* d = webview_->delegate(); if (d) { std::wstring wstr = webkit_glue::StringToStdWString(message); - return d->RunBeforeUnloadConfirm(webview_, wstr); + return d->RunBeforeUnloadConfirm(WebFrameImpl::FromFrame(frame), wstr); } return false; } @@ -325,7 +326,7 @@ void ChromeClientImpl::runJavaScriptAlert(WebCore::Frame* frame, #endif std::wstring wstr = webkit_glue::StringToStdWString(message); - d->RunJavaScriptAlert(webview_, wstr); + d->RunJavaScriptAlert(WebFrameImpl::FromFrame(frame), wstr); } } @@ -335,7 +336,7 @@ bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame, WebViewDelegate* d = webview_->delegate(); if (d) { std::wstring wstr = webkit_glue::StringToStdWString(message); - return d->RunJavaScriptConfirm(webview_, wstr); + return d->RunJavaScriptConfirm(WebFrameImpl::FromFrame(frame), wstr); } return false; } @@ -350,7 +351,7 @@ bool ChromeClientImpl::runJavaScriptPrompt(WebCore::Frame* frame, std::wstring wstr_message = webkit_glue::StringToStdWString(message); std::wstring wstr_default = webkit_glue::StringToStdWString(defaultValue); std::wstring wstr_result; - bool ok = d->RunJavaScriptPrompt(webview_, + bool ok = d->RunJavaScriptPrompt(WebFrameImpl::FromFrame(frame), wstr_message, wstr_default, &wstr_result); diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 37eea8a..4a0cf01 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -114,11 +114,11 @@ class WebFrame { // lacks a history item. Otherwise, this will always be true. virtual bool HasCurrentHistoryState() const = 0; - // Returns the current URL of the frame, or the empty string if there is no + // Returns the current URL of the frame, or an empty GURL if there is no // URL to retrieve (for example, the frame may never have had any content). virtual GURL GetURL() const = 0; - // Returns the URL to the favorite icon for the frame. An empty string is + // Returns the URL to the favorite icon for the frame. An empty GURL is // returned if the frame has not finished loading, or the frame's URL // protocol is not http or https. virtual GURL GetFavIconURL() const = 0; diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h index 59d4d95..a1a90d2 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -498,9 +498,10 @@ class WebViewDelegate : virtual public WebWidgetDelegate { } // Displays a JavaScript alert panel associated with the given view. Clients - // should visually indicate that this panel comes from JavaScript. The panel + // should visually indicate that this panel comes from JavaScript and some + // information about the originating frame (at least the domain). The panel // should have a single OK button. - virtual void RunJavaScriptAlert(WebView* webview, + virtual void RunJavaScriptAlert(WebFrame* webframe, const std::wstring& message) { } @@ -508,7 +509,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // Clients should visually indicate that this panel comes // from JavaScript. The panel should have two buttons, e.g. "OK" and // "Cancel". Returns true if the user hit OK, or false if the user hit Cancel. - virtual bool RunJavaScriptConfirm(WebView* webview, + virtual bool RunJavaScriptConfirm(WebFrame* webframe, const std::wstring& message) { return false; } @@ -520,7 +521,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // panel when it is shown. If the user hit OK, returns true and fills result // with the text in the box. The value of result is undefined if the user // hit Cancel. - virtual bool RunJavaScriptPrompt(WebView* webview, + virtual bool RunJavaScriptPrompt(WebFrame* webframe, const std::wstring& message, const std::wstring& default_value, std::wstring* result) { @@ -536,7 +537,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate { // that the navigation should continue, and Cancel means that the navigation // should be cancelled, leaving the user on the current page. Returns true // if the user hit OK, or false if the user hit Cancel. - virtual bool RunBeforeUnloadConfirm(WebView* webview, + virtual bool RunBeforeUnloadConfirm(WebFrame* webframe, const std::wstring& message) { return true; // OK, continue to navigate away } |