Bug 820135 - Preferences: We don't save prefs when we reboot. r=cjones, a=blocking-basecamp
authorGregor Wagner <anygregor@gmail.com>
Wed, 12 Dec 2012 15:41:07 -0800
changeset 118872 8baad7d3a599620f0c3c6884c40ffbc45b877a2d
parent 118871 6a14a959278bdc6dd18ae20ec00f5e8838075855
child 118873 c64e8462a68ba5381495edc027107ba03cd203d4
push idunknown
push userunknown
push dateunknown
reviewerscjones, blocking-basecamp
bugs820135
milestone19.0a2
Bug 820135 - Preferences: We don't save prefs when we reboot. r=cjones, a=blocking-basecamp
dom/power/PowerManagerService.cpp
hal/linux/LinuxPower.cpp
--- a/dom/power/PowerManagerService.cpp
+++ b/dom/power/PowerManagerService.cpp
@@ -136,16 +136,19 @@ NS_IMETHODIMP
 PowerManagerService::Restart()
 {
   // FIXME/bug 796826 this implementation is currently gonk-specific,
   // because it relies on the Gonk to initialize the Gecko processes to
   // restart B2G. It's better to do it here to have a real "restart".
   StartForceQuitWatchdog(eHalShutdownMode_Restart, mWatchdogTimeoutSecs);
   // To synchronize any unsaved user data before restarting.
   SyncProfile();
+#ifdef XP_UNIX
+  sync();
+#endif
   _exit(0);
   MOZ_NOT_REACHED();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PowerManagerService::AddWakeLockListener(nsIDOMMozWakeLockListener *aListener)
 {
--- a/hal/linux/LinuxPower.cpp
+++ b/hal/linux/LinuxPower.cpp
@@ -9,22 +9,24 @@
 #include <sys/reboot.h>
 
 namespace mozilla {
 namespace hal_impl {
 
 void
 Reboot()
 {
+  sync();
   reboot(RB_AUTOBOOT);
 }
 
 void
 PowerOff()
 {
+  sync();
   reboot(RB_POWER_OFF);
 }
 
 // Structure to specify how watchdog pthread is going to work.
 typedef struct watchdogParam
 {
   hal::ShutdownMode mode; // Specify how to shutdown the system.
   int32_t timeoutSecs;    // Specify the delayed seconds to shutdown the system.