From d1727268c97a67a0ad6df6b65109227daf0fd23f Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 19 Dec 2012 00:13:43 -0500 Subject: [PATCH] Bug 822020 - Remove the global PB specific code from the toolkit downloads UI; r=jdm --- toolkit/mozapps/downloads/content/downloads.js | 8 ++++++++ toolkit/mozapps/downloads/content/downloads.xul | 5 ++++- toolkit/mozapps/downloads/tests/chrome/Makefile.in | 7 ++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/toolkit/mozapps/downloads/content/downloads.js b/toolkit/mozapps/downloads/content/downloads.js index 7177fab5190..04d42181f7a 100644 --- a/toolkit/mozapps/downloads/content/downloads.js +++ b/toolkit/mozapps/downloads/content/downloads.js @@ -436,8 +436,10 @@ function Startup() let obs = Cc["@mozilla.org/observer-service;1"]. getService(Ci.nsIObserverService); obs.addObserver(gDownloadObserver, "download-manager-remove-download", false); +#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING obs.addObserver(gDownloadObserver, "private-browsing", false); obs.addObserver(gDownloadObserver, "private-browsing-change-granted", false); +#endif obs.addObserver(gDownloadObserver, "browser-lastwindow-close-granted", false); // Clear the search box and move focus to the list on escape from the box @@ -462,8 +464,10 @@ function Shutdown() let obs = Cc["@mozilla.org/observer-service;1"]. getService(Ci.nsIObserverService); +#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING obs.removeObserver(gDownloadObserver, "private-browsing"); obs.removeObserver(gDownloadObserver, "private-browsing-change-granted"); +#endif obs.removeObserver(gDownloadObserver, "download-manager-remove-download"); obs.removeObserver(gDownloadObserver, "browser-lastwindow-close-granted"); @@ -488,6 +492,7 @@ let gDownloadObserver = { let dl = getDownload(id.data); removeFromView(dl); break; +#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING case "private-browsing-change-granted": // Finalize our statements cause the connection will be closed by the // service during the private browsing transition. @@ -515,6 +520,7 @@ let gDownloadObserver = { }, 0); } break; +#endif case "browser-lastwindow-close-granted": #ifndef XP_MACOSX if (gDownloadManager.activeDownloadCount == 0) { @@ -1346,10 +1352,12 @@ function getDownload(aID) /** * Initialize the statement which is used to retrieve the list of downloads. +#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING * * This function gets called both at startup, and when entering the private * browsing mode (because the database connection is changed when entering * the private browsing mode, and a new statement should be initialized. +#endif */ function initStatement() { diff --git a/toolkit/mozapps/downloads/content/downloads.xul b/toolkit/mozapps/downloads/content/downloads.xul index 0745b16e4ee..e4314a565f8 100644 --- a/toolkit/mozapps/downloads/content/downloads.xul +++ b/toolkit/mozapps/downloads/content/downloads.xul @@ -25,7 +25,10 @@