Bug 822020 - Remove the global PB specific code from the toolkit downloads UI; r=jdm

This commit is contained in:
Ehsan Akhgari 2012-12-19 00:13:43 -05:00
parent 3ade4aa0a6
commit d1727268c9
3 changed files with 18 additions and 2 deletions

View File

@ -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()
{

View File

@ -25,7 +25,10 @@
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="downloadManager" windowtype="Download:Manager"
orient="vertical" title="&downloads.title;" statictitle="&downloads.title;"
orient="vertical" title="&downloads.title;"
#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
statictitle="&downloads.title;"
#endif
width="&window.width2;" height="&window.height;" screenX="10" screenY="10"
persist="width height screenX screenY sizemode"
onload="Startup();" onunload="Shutdown();"

View File

@ -30,7 +30,6 @@ MOCHITEST_CHROME_FILES = \
test_search_keys.xul \
test_select_all.xul \
test_space_key_pauses_resumes.xul \
test_privatebrowsing_title.xul \
test_ui_stays_open_on_alert_clickback.xul \
test_unknownContentType_dialog_layout.xul \
test_bug_412360.xul \
@ -56,4 +55,10 @@ MOCHITEST_CHROME_FILES += \
$(NULL)
endif
ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
MOCHITEST_CHROME_FILES += \
test_privatebrowsing_title.xul \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk