fix for bug #380340: move the places shutdown work to on the profile-before-change event. r=mano

This commit is contained in:
sspitzer@mozilla.org 2007-05-10 17:42:22 -07:00
parent 8da2c1e27f
commit e06f0386f7

View File

@ -58,6 +58,9 @@ BrowserGlue.prototype = {
case "xpcom-shutdown":
this._dispose();
break;
case "profile-before-change":
this._onProfileChange();
break;
case "profile-change-teardown":
this._onProfileShutdown();
break;
@ -80,6 +83,7 @@ BrowserGlue.prototype = {
// observer registration
const osvr = Components.classes['@mozilla.org/observer-service;1']
.getService(Components.interfaces.nsIObserverService);
osvr.addObserver(this, "profile-before-change", false);
osvr.addObserver(this, "profile-change-teardown", false);
osvr.addObserver(this, "xpcom-shutdown", false);
osvr.addObserver(this, "final-ui-startup", false);
@ -92,6 +96,7 @@ BrowserGlue.prototype = {
// observer removal
const osvr = Components.classes['@mozilla.org/observer-service;1']
.getService(Components.interfaces.nsIObserverService);
osvr.removeObserver(this, "profile-before-change");
osvr.removeObserver(this, "profile-change-teardown");
osvr.removeObserver(this, "xpcom-shutdown");
osvr.removeObserver(this, "final-ui-startup");
@ -136,15 +141,19 @@ BrowserGlue.prototype = {
this._profileStarted = true;
},
// profile shutdown handler (contains profile cleanup routines)
_onProfileShutdown: function()
_onProfileChange: function()
{
// this block is for code that depends on _onProfileStartup() having been called.
// this block is for code that depends on _onProfileStartup() having
// been called.
if (this._profileStarted) {
// final places cleanup
this._shutdownPlaces();
}
},
// profile shutdown handler (contains profile cleanup routines)
_onProfileShutdown: function()
{
// here we enter last survival area, in order to avoid multiple
// "quit-application" notifications caused by late window closings
const appStartup = Components.classes['@mozilla.org/toolkit/app-startup;1']