Bug 682618 - Explicitly blur and focus elements to ensure IsCommandEnabled calls are dispatched to correct element. r=gavin

This commit is contained in:
Graeme McCutcheon 2011-09-10 17:17:36 +01:00
parent b7cca4ceda
commit 0898a23076

View File

@ -27,6 +27,10 @@ function openContextMenuFor(element, shiftkey) {
// Context menu should be closed before we open it again. // Context menu should be closed before we open it again.
is(contextMenu.state, "closed", "checking if popup is closed"); is(contextMenu.state, "closed", "checking if popup is closed");
if (lastElement)
lastElement.blur();
element.focus();
lastElement = element;
var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey }; var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView); synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
} }
@ -555,7 +559,7 @@ function runTest(testNum) {
var testNum = 1; var testNum = 1;
var subwindow, chromeWin, contextMenu; var subwindow, chromeWin, contextMenu, lastElement;
var text, link, mailto, input, img, canvas, video_ok, video_bad, video_bad2, var text, link, mailto, input, img, canvas, video_ok, video_bad, video_bad2,
iframe, textarea, contenteditable, inputspell, pagemenu; iframe, textarea, contenteditable, inputspell, pagemenu;
@ -577,6 +581,8 @@ function startTest() {
return; return;
} }
lastElement = null;
text = subwindow.document.getElementById("test-text"); text = subwindow.document.getElementById("test-text");
link = subwindow.document.getElementById("test-link"); link = subwindow.document.getElementById("test-link");
mailto = subwindow.document.getElementById("test-mailto"); mailto = subwindow.document.getElementById("test-mailto");