зеркало из https://github.com/mozilla/gecko-dev.git
Bug 585841 - Right click, 'copy link location' no longer works
r=Neil a=blocking2.0 a=sheriff for landing
This commit is contained in:
Родитель
a484089327
Коммит
78f7ba2d70
|
@ -36,6 +36,20 @@ function closeContextMenu() {
|
|||
contextMenu.hidePopup();
|
||||
}
|
||||
|
||||
function executeCopyCommand(command, expectedValue)
|
||||
{
|
||||
// Just execute the command directly rather than simulating a context menu
|
||||
// press to avoid having to deal with its asynchronous nature
|
||||
subwindow.controllers.getControllerForCommand(command).doCommand(command);
|
||||
|
||||
// The easiest way to check the clipboard is to paste the contents into a
|
||||
// textbox
|
||||
input.focus();
|
||||
input.value = "";
|
||||
input.controllers.getControllerForCommand("cmd_paste").doCommand("cmd_paste");
|
||||
is(input.value, expectedValue, "paste for command " + command);
|
||||
}
|
||||
|
||||
function getVisibleMenuItems(aMenu) {
|
||||
var items = [];
|
||||
var accessKeys = {};
|
||||
|
@ -391,6 +405,13 @@ function runTest(testNum) {
|
|||
"spell-add-dictionaries", true], null]);
|
||||
|
||||
closeContextMenu();
|
||||
openContextMenuFor(link); // Invoke context menu for next test.
|
||||
break;
|
||||
|
||||
case 15:
|
||||
executeCopyCommand("cmd_copyLink", "http://mozilla.com/");
|
||||
closeContextMenu();
|
||||
|
||||
subwindow.close();
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
|
|
|
@ -3328,6 +3328,8 @@ DocumentViewerImpl::GetPopupNode(nsIDOMNode** aNode)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aNode);
|
||||
|
||||
*aNode = nsnull;
|
||||
|
||||
// get the document
|
||||
nsIDocument* document = GetDocument();
|
||||
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
|
||||
|
@ -3340,7 +3342,22 @@ DocumentViewerImpl::GetPopupNode(nsIDOMNode** aNode)
|
|||
NS_ENSURE_TRUE(root, NS_ERROR_FAILURE);
|
||||
|
||||
// get the popup node
|
||||
NS_IF_ADDREF(*aNode = root->GetPopupNode());
|
||||
nsCOMPtr<nsIDOMNode> node = root->GetPopupNode();
|
||||
#ifdef MOZ_XUL
|
||||
if (!node) {
|
||||
nsPIDOMWindow* rootWindow = root->GetWindow();
|
||||
if (rootWindow) {
|
||||
nsCOMPtr<nsIDocument> rootDoc = do_QueryInterface(rootWindow->GetExtantDocument());
|
||||
if (rootDoc) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm) {
|
||||
node = pm->GetLastTriggerPopupNode(rootDoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
node.swap(*aNode);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче