Bug 712871. (Fv1) Port bug 682618 ('lastElement'), Port bug 46555 ('context-selectall' fix). r=neil.
authorSerge Gautherie <sgautherie.bz@free.fr>
Fri, 23 Dec 2011 04:09:47 +0100
changeset 10284 d4a15b0bd70ea00b4047e2a2d7099371e6161697
parent 10283 f59488355a189fba512885b0c1e2eca45bad344c
child 10285 d0537d740e8ea747bcbc8a2258578feabbbe917f
push idunknown
push userunknown
push dateunknown
reviewersneil
bugs712871, 682618, 46555
Bug 712871. (Fv1) Port bug 682618 ('lastElement'), Port bug 46555 ('context-selectall' fix). r=neil.
suite/browser/test/mochitest/test_contextmenu.html
--- a/suite/browser/test/mochitest/test_contextmenu.html
+++ b/suite/browser/test/mochitest/test_contextmenu.html
@@ -23,16 +23,20 @@ netscape.security.PrivilegeManager.enabl
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 function openContextMenuFor(element, shiftkey) {
     // Context menu should be closed before we open it again.
     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 };
     synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
 }
 
 function closeContextMenu() {
     contextMenu.hidePopup();
 }
 
@@ -299,17 +303,17 @@ function runTest(testNum) {
                           "context-undo",        false,
                           "context-redo",        false,
                           "---",                 null,
                           "context-cut",         false,
                           "context-copy",        false,
                           "context-paste",       null, // ignore clipboard state
                           "context-delete",      false,
                           "---",                 null,
-                          "context-selectall",   true,
+                          "context-selectall",   false,
                           "---",                 null,
                           "spell-check-enabled", true]);
         closeContextMenu()
         openContextMenuFor(img); // Invoke context menu for next test.
         break;
 
     case 6:
         // Context menu for an image
@@ -672,17 +676,17 @@ function runTest(testNum) {
         SimpleTest.finish();
         return;
   }
 
 }
 
 
 var testNum = 1;
-var subwindow, chromeWin, contextMenu;
+var subwindow, chromeWin, contextMenu, lastElement;
 var text, link, mailto, input, img, img_link, img_mailto, canvas, video_ok,
     video_bad, video_bad2, iframe, textarea, contenteditable, inputspell,
     pagemenu;
 
 function startTest() {
     netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
     chromeWin = subwindow
                     .QueryInterface(Ci.nsIInterfaceRequestor)
@@ -696,16 +700,18 @@ function startTest() {
     ok(contextMenu, "Got context menu XUL");
 
     if (chromeWin.document.getElementById("context-stop").getAttribute("disabled") != "true") {
       isnot(false, "Document still loading");
       SimpleTest.executeSoon(startTest);
       return;
     }
 
+    lastElement = null;
+
     text       = subwindow.document.getElementById("test-text");
     link       = subwindow.document.getElementById("test-link");
     mailto     = subwindow.document.getElementById("test-mailto");
     input      = subwindow.document.getElementById("test-input");
     img        = subwindow.document.getElementById("test-image");
     img_link   = subwindow.document.getElementById("test-image-link");
     img_mailto = subwindow.document.getElementById("test-image-mailto");
     canvas     = subwindow.document.getElementById("test-canvas");