зеркало из https://github.com/mozilla/pjs.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:
Родитель
81ce8fc9a7
Коммит
7d9da2db70
|
@ -36,6 +36,20 @@ function closeContextMenu() {
|
||||||
contextMenu.hidePopup();
|
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) {
|
function getVisibleMenuItems(aMenu) {
|
||||||
var items = [];
|
var items = [];
|
||||||
var accessKeys = {};
|
var accessKeys = {};
|
||||||
|
@ -391,6 +405,13 @@ function runTest(testNum) {
|
||||||
"spell-add-dictionaries", true], null]);
|
"spell-add-dictionaries", true], null]);
|
||||||
|
|
||||||
closeContextMenu();
|
closeContextMenu();
|
||||||
|
openContextMenuFor(link); // Invoke context menu for next test.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
executeCopyCommand("cmd_copyLink", "http://mozilla.com/");
|
||||||
|
closeContextMenu();
|
||||||
|
|
||||||
subwindow.close();
|
subwindow.close();
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3328,6 +3328,8 @@ DocumentViewerImpl::GetPopupNode(nsIDOMNode** aNode)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aNode);
|
NS_ENSURE_ARG_POINTER(aNode);
|
||||||
|
|
||||||
|
*aNode = nsnull;
|
||||||
|
|
||||||
// get the document
|
// get the document
|
||||||
nsIDocument* document = GetDocument();
|
nsIDocument* document = GetDocument();
|
||||||
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
|
||||||
|
@ -3340,7 +3342,22 @@ DocumentViewerImpl::GetPopupNode(nsIDOMNode** aNode)
|
||||||
NS_ENSURE_TRUE(root, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(root, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
// get the popup node
|
// 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;
|
return NS_OK;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче