Avoid crashing on Mac OS X by not allowing the download window to autoclose if the user has interacted with the properties dialog. It shouldn't autoclose after having significant user interaction, so this sort of fixes two bugs. b=321914 r=mento sr=mconnor

This commit is contained in:
joshmoz%gmail.com 2006-01-09 20:36:45 +00:00
Родитель 810651b9f9
Коммит f00cefc089
1 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -24,6 +24,7 @@
# Ben Goodger <ben@bengoodger.com> (v2.0)
# Dan Mosedale <dmose@mozilla.org>
# Fredrik Holmqvist <thesuckiestemail@yahoo.se>
# Josh Aas <josh@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -59,7 +60,11 @@ var gActiveDownloads = [];
// opened by the xpinstall manager prevents the window from being closed after
// each download completes (because xpinstall downloads are done sequentially,
// not concurrently)
var gCanAutoClose = true;
var gCanAutoClose = true;
// If the user has interacted with the window in a significant way, we should
// not auto-close the window. Tough UI decisions about what is "significant."
var gUserInteracted = false;
///////////////////////////////////////////////////////////////////////////////
// Utility Functions
@ -182,14 +187,12 @@ function autoClose(aDownload)
// For the moment, just use the simple heuristic that if this window was
// opened by the download process, rather than by the user, it should auto-close
// if the pref is set that way. If the user opened it themselves, it should
// not close until they explicitly close it.
// We may like to revisit this in a bit more detail later, perhaps we want
// to keep it up if the user messes with it in a significant way.
// not close until they explicitly close it.
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var autoClose = pref.getBoolPref(PREF_BDM_CLOSEWHENDONE)
if (autoClose && (!window.opener || window.opener.location.href == window.location.href) &&
gCanAutoClose)
gCanAutoClose && !gUserInteracted)
gCloseDownloadManager();
}
}
@ -422,6 +425,7 @@ function onDownloadOpenWith(aEvent)
function onDownloadProperties(aEvent)
{
gUserInteracted = true;
window.openDialog("chrome://mozapps/content/downloads/downloadProperties.xul",
"_blank", "modal,centerscreen,chrome,resizable=no", aEvent.target.id);
}