Bug 682580 - Remove suite's dependency on nsTryToClose.js r=neil a=CLOSED TREE
This commit is contained in:
Родитель
0eed72a1cd
Коммит
aa0976835b
|
@ -211,12 +211,6 @@ SuiteGlue.prototype = {
|
|||
this._isPlacesLockedObserver = true;
|
||||
Services.obs.addObserver(this, "places-shutdown", false);
|
||||
this._isPlacesShutdownObserver = true;
|
||||
try {
|
||||
tryToClose = Components.classes["@mozilla.org/appshell/trytoclose;1"]
|
||||
.getService(Components.interfaces.nsIObserver);
|
||||
Services.obs.removeObserver(tryToClose, "quit-application-requested");
|
||||
Services.obs.addObserver(tryToClose, "quit-application-requested", true);
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
// cleanup (called on application shutdown)
|
||||
|
|
|
@ -383,8 +383,6 @@
|
|||
@BINPATH@/components/nsSetDefault.manifest
|
||||
#endif
|
||||
@BINPATH@/components/nsTaggingService.js
|
||||
@BINPATH@/components/nsTryToClose.js
|
||||
@BINPATH@/components/nsTryToClose.manifest
|
||||
@BINPATH@/components/nsTypeAheadFind.js
|
||||
#ifdef MOZ_UPDATER
|
||||
@BINPATH@/components/nsUpdateService.js
|
||||
|
|
|
@ -654,34 +654,46 @@ function updateOptionItems()
|
|||
goUpdateCommand("cmd_quoteMessage");
|
||||
}
|
||||
|
||||
var messageComposeOfflineObserver = {
|
||||
observe: function(subject, topic, state) {
|
||||
var messageComposeOfflineQuitObserver = {
|
||||
observe: function(aSubject, aTopic, aState) {
|
||||
// sanity checks
|
||||
if (topic != "network:offline-status-changed") return;
|
||||
MessageComposeOfflineStateChanged(state == "offline");
|
||||
if (aTopic == "network:offline-status-changed")
|
||||
{
|
||||
MessageComposeOfflineStateChanged(aState == "offline");
|
||||
|
||||
try {
|
||||
try {
|
||||
setupLdapAutocompleteSession();
|
||||
} catch (ex) {
|
||||
} catch (ex) {
|
||||
// catch the exception and ignore it, so that if LDAP setup
|
||||
// fails, the entire compose window stuff doesn't get aborted
|
||||
}
|
||||
}
|
||||
// check whether to veto the quit request (unless another observer already
|
||||
// did)
|
||||
else if (aTopic == "quit-application-requested" &&
|
||||
aSubject instanceof Components.interfaces.nsISupportsPRBool &&
|
||||
!aSubject.data)
|
||||
aSubject.data = !ComposeCanClose();
|
||||
}
|
||||
}
|
||||
|
||||
function AddMessageComposeOfflineObserver()
|
||||
function AddMessageComposeOfflineQuitObserver()
|
||||
{
|
||||
Services.obs.addObserver(messageComposeOfflineObserver,
|
||||
Services.obs.addObserver(messageComposeOfflineQuitObserver,
|
||||
"network:offline-status-changed", false);
|
||||
Services.obs.addObserver(messageComposeOfflineQuitObserver,
|
||||
"quit-application-requested", false);
|
||||
|
||||
// set the initial state of the send button
|
||||
MessageComposeOfflineStateChanged(Services.io.offline);
|
||||
}
|
||||
|
||||
function RemoveMessageComposeOfflineObserver()
|
||||
function RemoveMessageComposeOfflineQuitObserver()
|
||||
{
|
||||
Services.obs.removeObserver(messageComposeOfflineObserver,
|
||||
Services.obs.removeObserver(messageComposeOfflineQuitObserver,
|
||||
"network:offline-status-changed");
|
||||
Services.obs.removeObserver(messageComposeOfflineQuitObserver,
|
||||
"quit-application-requested");
|
||||
}
|
||||
|
||||
function MessageComposeOfflineStateChanged(goingOffline)
|
||||
|
@ -1494,7 +1506,7 @@ function ComposeLoad()
|
|||
dump("failed to get RDF\n");
|
||||
}
|
||||
|
||||
AddMessageComposeOfflineObserver();
|
||||
AddMessageComposeOfflineQuitObserver();
|
||||
AddDirectoryServerObserver(true);
|
||||
|
||||
if (gLogComposePerformance)
|
||||
|
@ -1524,7 +1536,6 @@ function ComposeLoad()
|
|||
MsgComposeCloseWindow(false); // Don't try to recycle a bogus window
|
||||
return;
|
||||
}
|
||||
window.tryToClose=ComposeCanClose;
|
||||
if (gLogComposePerformance)
|
||||
sMsgComposeService.TimeStamp("Done with the initialization (ComposeLoad). Waiting on editor to load about:blank", false);
|
||||
|
||||
|
@ -1546,8 +1557,9 @@ function ComposeUnload()
|
|||
|
||||
EditorCleanup();
|
||||
|
||||
RemoveMessageComposeOfflineObserver();
|
||||
RemoveMessageComposeOfflineQuitObserver();
|
||||
RemoveDirectoryServerObserver(null);
|
||||
|
||||
if (gCurrentIdentity)
|
||||
RemoveDirectoryServerObserver("mail.identity." + gCurrentIdentity.key);
|
||||
if (gCurrentAutocompleteDirectory)
|
||||
|
|
|
@ -717,7 +717,8 @@ function OnLoadMessenger()
|
|||
let tabmail = GetTabMail();
|
||||
tabmail.registerTabType(gMailNewsTabsType);
|
||||
tabmail.openFirstTab();
|
||||
window.tryToClose = MailWindowIsClosing;
|
||||
Services.obs.addObserver(MailWindowIsClosing,
|
||||
"quit-application-requested", false);
|
||||
|
||||
InitMsgWindow();
|
||||
messenger.setWindow(window, msgWindow);
|
||||
|
@ -819,6 +820,8 @@ function OnUnloadMessenger()
|
|||
pref.removeObserver("mail.pane_config.dynamic", MailPrefObserver, false);
|
||||
pref.removeObserver("mail.showCondensedAddresses", MailPrefObserver, false);
|
||||
window.removeEventListener("AppCommand", HandleAppCommandEvent, true);
|
||||
Services.obs.removeObserver(MailWindowIsClosing,
|
||||
"quit-application-requested");
|
||||
|
||||
OnLeavingFolder(gMsgFolderSelected); // mark all read in current folder
|
||||
accountManager.removeIncomingServerListener(gThreePaneIncomingServerListener);
|
||||
|
@ -831,8 +834,13 @@ function OnUnloadMessenger()
|
|||
}
|
||||
|
||||
// we probably want to warn if more than one tab is closed
|
||||
function MailWindowIsClosing()
|
||||
function MailWindowIsClosing(aCancelQuit, aTopic, aData)
|
||||
{
|
||||
if (aTopic == "quit-application-requested" &&
|
||||
aCancelQuit instanceof Components.interfaces.nsISupportsPRBool &&
|
||||
aCancelQuit.data)
|
||||
return false;
|
||||
|
||||
let reallyClose = true;
|
||||
let numtabs = GetTabMail().tabInfo.length;
|
||||
if (numtabs > 1)
|
||||
|
@ -859,6 +867,10 @@ function MailWindowIsClosing()
|
|||
pref.setBoolPref("browser.tabs.warnOnClose", false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!reallyClose && aTopic == "quit-application-requested")
|
||||
aCancelQuit.data = true;
|
||||
|
||||
return reallyClose;
|
||||
}
|
||||
|
||||
|
|
|
@ -202,7 +202,8 @@ function onLoad()
|
|||
// Focus the list.
|
||||
gFilterTree.focus();
|
||||
|
||||
window.tryToClose = onFilterClose;
|
||||
Services.obs.addObserver(onFilterClose,
|
||||
"quit-application-requested", false);
|
||||
|
||||
top.controllers.insertControllerAt(0, gFilterController);
|
||||
}
|
||||
|
@ -448,11 +449,17 @@ function onFilterUnload()
|
|||
if (filterList)
|
||||
filterList.saveToDefaultFile();
|
||||
|
||||
Services.obs.removeObserver(onFilterClose, "quit-application-requested");
|
||||
top.controllers.removeController(gFilterController);
|
||||
}
|
||||
|
||||
function onFilterClose()
|
||||
function onFilterClose(aCancelQuit, aTopic, aData)
|
||||
{
|
||||
if (aTopic == "quit-application-requested" &&
|
||||
aCancelQuit instanceof Components.interfaces.nsISupportsPRBool &&
|
||||
aCancelQuit.data)
|
||||
return false;
|
||||
|
||||
if (gRunFiltersButton.getAttribute("label") == gRunFiltersButton.getAttribute("stoplabel")) {
|
||||
var promptTitle = gFilterBundle.getString("promptTitle");
|
||||
var promptMsg = gFilterBundle.getString("promptMsg");;
|
||||
|
@ -463,10 +470,12 @@ function onFilterClose()
|
|||
(Services.prompt.BUTTON_TITLE_IS_STRING *
|
||||
Services.prompt.BUTTON_POS_0) +
|
||||
(Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1),
|
||||
continueButtonLabel, stopButtonLabel, null, null, {value:0}))
|
||||
gFilterListMsgWindow.StopUrls();
|
||||
else
|
||||
continueButtonLabel, stopButtonLabel, null, null, {value:0}) == 0) {
|
||||
if (aTopic == "quit-application-requested")
|
||||
aCancelQuit.data = true;
|
||||
return false;
|
||||
}
|
||||
gFilterListMsgWindow.StopUrls();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче