Bug 849440 Private downloads don't update r=IanN f=Ratty a=IanN
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Fri, 05 Apr 2013 21:56:29 +0100
changeset 14972 f3408ba1247a6ea767a3d2204242ba58232328d9
parent 14971 186f171a3d401b11b4981f9e817e4edd6395c79e
child 14973 161dfb7785ac327eb0bb23d74629de1e260c9dcb
push id870
push userneil@parkwaycc.co.uk
push dateFri, 05 Apr 2013 21:17:14 +0000
treeherdercomm-beta@997fbd08ee62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs849440
Bug 849440 Private downloads don't update r=IanN f=Ratty a=IanN
suite/common/downloads/progressDialog.js
--- a/suite/common/downloads/progressDialog.js
+++ b/suite/common/downloads/progressDialog.js
@@ -44,28 +44,31 @@ function progressStartup() {
   gTimeElapsed = document.getElementById("timeElapsed");
   gProgressMeter = document.getElementById("progressMeter");
   gProgressText = document.getElementById("progressText");
   gCloseWhenDone = document.getElementById("closeWhenDone");
 
   // Insert as first controller on the whole window
   window.controllers.insertControllerAt(0, ProgressDlgController);
 
-  gCloseWhenDone.checked = gPrefService.getBoolPref("browser.download.progress.closeWhenDone");
+  if (gDownload.isPrivate)
+    gCloseWhenDone.hidden = true;
+  else
+    gCloseWhenDone.checked = gPrefService.getBoolPref("browser.download.progress.closeWhenDone");
 
   switch (gDownload.state) {
     case nsIDownloadManager.DOWNLOAD_NOTSTARTED:
     case nsIDownloadManager.DOWNLOAD_DOWNLOADING:
     case nsIDownloadManager.DOWNLOAD_PAUSED:
     case nsIDownloadManager.DOWNLOAD_QUEUED:
     case nsIDownloadManager.DOWNLOAD_SCANNING:
       gDlActive = true;
       break;
     case nsIDownloadManager.DOWNLOAD_FINISHED:
-      if (gCloseWhenDone.checked)
+      if (gCloseWhenDone.checked && window.arguments[1])
         window.close();
     default:
       gDlActive = false;
       break;
   }
 
   var fName = document.getElementById("fileName");
   var fSource = document.getElementById("fileSource");
@@ -78,32 +81,33 @@ function progressStartup() {
   catch (e) { }
   if (!fromString)
     fromString = gDownload.source.prePath;
   fSource.label = gDownloadBundle.getFormattedString("fromSource", [fromString]);
   fSource.tooltipText = gDownload.source.spec;
 
   // The DlProgressListener handles progress notifications.
   gDownloadListener = new DlProgressListener();
-  gDownloadManager.addListener(gDownloadListener);
+  gDownloadManager.addPrivacyAwareListener(gDownloadListener);
 
   updateDownload();
   updateButtons();
   window.updateCommands("dlstate-change");
 
   // Send a notification that we finished
   setTimeout(function()
     Services.obs.notifyObservers(window, "download-manager-ui-done", null), 0);
 }
 
 function progressShutdown() {
   gDownloadManager.removeListener(gDownloadListener);
   window.controllers.removeController(ProgressDlgController);
-  gPrefService.setBoolPref("browser.download.progress.closeWhenDone",
-                           gCloseWhenDone.checked);
+  if (!gCloseWhenDone.hidden)
+    gPrefService.setBoolPref("browser.download.progress.closeWhenDone",
+                             gCloseWhenDone.checked);
 }
 
 function updateDownload() {
   switch (gDownload.state) {
     case nsIDownloadManager.DOWNLOAD_DOWNLOADING:
       // At this point, we know if we are an indeterminate download or not.
       if (gDownload.percentComplete == -1) {
         gProgressText.hidden = true;