rem:  gDownloadsView.database.AddDataSource(gDownloadManager.datasource); gDownloadsView.builder.rebuild();  
context: function Startup() {  gDownloadsView = document.getElementById("downloadView");  const dlmgrContractID = "@mozilla.org/download-manager;1";  const dlmgrIID = Components.interfaces.nsIDownloadManager;  gDownloadManager = Components.classes[dlmgrContractID].getService(dlmgrIID);    // The DownloadProgressListener (DownloadProgressListener.js) handles progress  // notifications.   var downloadStrings = document.getElementById("downloadStrings");  gDownloadListener = new DownloadProgressListener(document, downloadStrings);  gDownloadManager.listener = gDownloadListener;  // The active downloads list is created by the front end only when the download starts,    // so we need to pre-populate it with any downloads that were already going.   var activeDownloads = gDownloadManager.activeDownloads;  var count = activeDownloads.Count();  for (var i = 0; i < count; ++i)    gActiveDownloads.push(activeDownloads.QueryElementAt(i, Components.interfaces.nsIDownload));  // Handlers for events generated by the UI (downloads, list view)  gDownloadsView.addEventListener("download-cancel",      onDownloadCancel,     false);  gDownloadsView.addEventListener("download-pause",       onDownloadPause,      false);  gDownloadsView.addEventListener("download-resume",      onDownloadResume,     false);  gDownloadsView.addEventListener("download-remove",      onDownloadRemove,     false);  gDownloadsView.addEventListener("download-show",        onDownloadShow,       false);  gDownloadsView.addEventListener("download-open",        onDownloadOpen,       false);  gDownloadsView.addEventListener("download-retry",       onDownloadRetry,      false);  gDownloadsView.addEventListener("download-animated",    onDownloadAnimated,   false);  gDownloadsView.addEventListener("download-properties",  onDownloadProperties, false);  gDownloadsView.addEventListener("dblclick",             onDownloadOpen,       false);    // Set up AutoDownload display area  initAutoDownloadDisplay();  var pbi = Components.classes["@mozilla.org/preferences-service;1"]                      .getService(Components.interfaces.nsIPrefBranch2);  pbi.addObserver("browser.download.", gDownloadPrefObserver, false);    // Handlers for events generated by the Download Manager (download events)  var observerService = Components.classes[kObserverServiceProgID]                                  .getService(Components.interfaces.nsIObserverService);  observerService.addObserver(gDownloadObserver, "dl-done",   false);  observerService.addObserver(gDownloadObserver, "dl-cancel", false);  observerService.addObserver(gDownloadObserver, "dl-failed", false);    observerService.addObserver(gDownloadObserver, "dl-start",  false);    observerService.addObserver(gDownloadObserver, "xpinstall-download-started", false);    observerService.addObserver(gDownloadObserver, "xpinstall-dialog-close",     false);    // Now look and see if we're being opened by XPInstall  if ("arguments" in window) {    try {      var params = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);      var installObserver = window.arguments[1].QueryInterface(Components.interfaces.nsIObserver);      XPInstallDownloadManager.addDownloads(params, installObserver);      var mgr = gDownloadManager.QueryInterface(Components.interfaces.nsIXPInstallManagerUI);      gCanAutoClose = mgr.hasActiveXPIOperations;    }    catch (e) { }  }  // This is for the "Clean Up" button, which requires there to be  // non-active downloads before it can be enabled.   gDownloadsView.controllers.appendController(gDownloadViewController);  // Finally, update the UI.   gDownloadsView.database.AddDataSource(gDownloadManager.datasource);  gDownloadsView.builder.rebuild();    // downloads can finish before Startup() does, so check if the window should close  autoClose();}
meta: 10520	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/10520/1b10f8ae550c672e815ef76929b93f2d1bfd9077/downloads.js/buggy/toolkit/mozapps/downloads/content/downloads.js