Bug 548582 - FastStartup should save prefs when the final window closes, r=mfinkle
authorBrian Crowder <crowder@fiverocks.com>
Thu, 08 Apr 2010 12:19:32 -0700
changeset 40602 09b8c8ae809cbd2b6f9d3a53f8527f3b3ae1f98e
parent 40601 af843a2c70a8ccf837deb57705c69fc60f60f9d2
child 40603 076041952721c07c545baba1c27bde2d0a232df0
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs548582
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 548582 - FastStartup should save prefs when the final window closes, r=mfinkle
toolkit/components/faststart/FastStartup.js
--- a/toolkit/components/faststart/FastStartup.js
+++ b/toolkit/components/faststart/FastStartup.js
@@ -123,18 +123,21 @@ function nsFastStartupObserver() {
     // win.document.documentURI will pretty much always be about:blank.  We need
     // to attach a load handler to actually figure out which document gets loaded.
     if (topic == "domwindowopened") {
       stopMemoryCleanup();
       _browserWindowCount++;
     } else if (topic == "domwindowclosed") {
       if (_browserWindowCount > 0)
         _browserWindowCount--;
-      if (_browserWindowCount == 0)
+      if (_browserWindowCount == 0) {
         scheduleMemoryCleanup();
+        let prefservice = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService);
+        prefservice.savePrefFile(null);
+      }
     } else if (topic == "quit-application-granted") {
       stopMemoryCleanup();
       _isShuttingDown = true;
       let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].
                        getService(Ci.nsIAppStartup);
       appstartup.exitLastWindowClosingSurvivalArea();
     }
   }