diff --git a/third_party/firefox_sendtophone/chrome/content/overlay.js b/third_party/firefox_sendtophone/chrome/content/overlay.js index 5f4e749..b5cf613 100644 --- a/third_party/firefox_sendtophone/chrome/content/overlay.js +++ b/third_party/firefox_sendtophone/chrome/content/overlay.js @@ -58,13 +58,17 @@ var sendtophone = { case 'text': title = "Selection"; url = 'http://www.google.com/'; - if (gContextMenu.onTextInput) + var input = gContextMenu.target; + if (gContextMenu.onTextInput && input && input.value) { - var input = gContextMenu.target; selection = input.value.substring(input.selectionStart, input.selectionEnd); } else - selection = content.getSelection().toString(); + { + // Get the selection from the correct iframe + var focusedWindow = document.commandDispatcher.focusedWindow; + selection = focusedWindow.getSelection().toString(); + } break; case 'page': default: