Bug 657462: don't select the first item in the download manager automatically, r=dolske, a=LegNeato CAMINO_2_1_MINIBRANCH
authorGavin Sharp <gavin@gavinsharp.com>
Fri, 30 Sep 2011 09:51:17 -0700
branchCAMINO_2_1_MINIBRANCH
changeset 35223 f111c39a68f61488fbfa858f44207935293d2329
parent 35222 1169f4d058e8e345f3fca89d0e89d746770f5794
child 35224 eb499b0c7d8cd70aacfb81384b013e6afa836805
push id1998
push useralqahira@ardisson.org
push dateThu, 03 Nov 2011 02:27:52 +0000
reviewersdolske, LegNeato
bugs657462
milestone1.9.2.23
Bug 657462: don't select the first item in the download manager automatically, r=dolske, a=LegNeato
toolkit/mozapps/downloads/content/downloads.js
toolkit/mozapps/downloads/tests/chrome/test_backspace_key_removes.xul
toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
toolkit/mozapps/downloads/tests/chrome/test_delete_key_removes.xul
--- a/toolkit/mozapps/downloads/content/downloads.js
+++ b/toolkit/mozapps/downloads/content/downloads.js
@@ -1166,17 +1166,16 @@ function buildDownloadList(aForceBuild)
     gStmt.reset();
     return;
   }
 
   // Take a quick break before we actually start building the list
   gBuilder = setTimeout(function() {
     // Start building the list and select the first item
     stepListBuilder(1);
-    gDownloadsView.selectedIndex = 0;
 
     // We just tried to add a single item, so we probably need to enable
     updateClearListButton();
   }, 0);
 }
 
 /**
  * Incrementally build the download list by adding at most the requested number
--- a/toolkit/mozapps/downloads/tests/chrome/test_backspace_key_removes.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_backspace_key_removes.xul
@@ -166,16 +166,17 @@ function test()
 
   function deleteDownload(win) {
     let doc = win.document;
 
     let stmt = db.createStatement("SELECT COUNT(*) FROM moz_downloads");
     try {
       stmt.executeStep();
       let richlistbox = doc.getElementById("downloadView");
+      richlistbox.selectedIndex = 0;
       is(stmt.getInt32(0), richlistbox.children.length,
          "The database and the number of downloads display matches");
       stmt.reset();
 
       let len = DownloadData.length;
       for (let i = 0; i < len; i++) {
         synthesizeKey("VK_BACK_SPACE", {}, win);
 
--- a/toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
@@ -173,24 +173,28 @@ function test()
   const DLMGR_UI_DONE = "download-manager-ui-done";
 
   let testObs = {
     observe: function(aSubject, aTopic, aData)
     {
       if (aTopic != DLMGR_UI_DONE)
         return;
 
-      SimpleTest.waitForFocus(function () { sendEnter(aSubject) }, aSubject);
-    }
-  };
+      os.removeObserver(testObs, DLMGR_UI_DONE);
+
+      SimpleTest.waitForFocus(function () {
+        let win = aSubject;
 
-  function sendEnter(win) {
-    // Send the enter key to Download Manager to retry the download
-    synthesizeKey("VK_ENTER", {}, win);
-    os.removeObserver(testObs, DLMGR_UI_DONE);
+        // Down arrow to select the download
+        synthesizeKey("VK_DOWN", {}, win);
+
+        // Enter key to retry the download
+        synthesizeKey("VK_ENTER", {}, win);
+      }, aSubject);
+    }
   };
 
   // Register with the observer service
   os.addObserver(testObs, DLMGR_UI_DONE, false);
 
   // Show the Download Manager UI
   dmui.show();
 
--- a/toolkit/mozapps/downloads/tests/chrome/test_delete_key_removes.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_delete_key_removes.xul
@@ -171,16 +171,17 @@ function test()
 
   function deleteDownload(win) {
     let doc = win.document;
 
     let stmt = db.createStatement("SELECT COUNT(*) FROM moz_downloads");
     try {
       stmt.executeStep();
       let richlistbox = doc.getElementById("downloadView");
+      richlistbox.selectedIndex = 0;
       is(stmt.getInt32(0), richlistbox.children.length,
          "The database and the number of downloads display matches");
       stmt.reset();
 
       let len = DownloadData.length;
       for (let i = 0; i < len; i++) {
         synthesizeKey("VK_DELETE", {}, win);