summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-10 01:32:21 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-10 01:32:21 +0000
commit5640b90777c362df2921b12b314cbe50b0016310 (patch)
tree72531677038b0541f307b05a8b591bd15115fa95 /webkit/tools
parentf7b624a6f6c9c08cd098135ce0407807d3677ed0 (diff)
downloadchromium_src-5640b90777c362df2921b12b314cbe50b0016310.zip
chromium_src-5640b90777c362df2921b12b314cbe50b0016310.tar.gz
chromium_src-5640b90777c362df2921b12b314cbe50b0016310.tar.bz2
Fix a crash in the copy selection code. If there's no
selection, we get a null range, so check for it. Also fallback if there's no frame with focus to the main frame. The webkit gtk code does this as well. Review URL: http://codereview.chromium.org/13297 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/test_shell/test_webview_delegate_gtk.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
index 3866e3d..3b0bf82 100644
--- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
@@ -47,6 +47,10 @@ void SelectionClipboardGetContents(GtkClipboard* clipboard,
WebView* webview = static_cast<WebView*>(data);
WebFrame* frame = webview->GetFocusedFrame();
+ if (!frame)
+ frame = webview->GetMainFrame();
+ DCHECK(frame);
+
std::string selection = frame->GetSelection(TEXT_HTML == info);
if (TEXT_HTML == info) {
gtk_selection_data_set(selection_data,