Bug 844331 - part 1 - add profile-before-change2 notification; r=bsmedberg; a=bajaj
authorNathan Froyd <froydnj@mozilla.com>
Thu, 28 Mar 2013 10:53:00 -0400
changeset 132499 643f2a7549727e02c2cd5fc348c94fb6ecddf2da
parent 132498 dc9bc44e7f1ce0984f657ec5e76f4816583ac182
child 132500 da9a2b8a16cca8e331acfc9056323104b1a467d9
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, bajaj
bugs844331
milestone21.0a2
Bug 844331 - part 1 - add profile-before-change2 notification; r=bsmedberg; a=bajaj
dom/power/PowerManagerService.cpp
profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp
toolkit/xre/nsXREDirProvider.cpp
widget/android/nsAppShell.cpp
widget/windows/nsWindow.cpp
xpcom/tests/TestHarness.h
--- a/dom/power/PowerManagerService.cpp
+++ b/dom/power/PowerManagerService.cpp
@@ -103,16 +103,17 @@ void
 PowerManagerService::SyncProfile()
 {
   nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
   if (obsServ) {
     NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
     obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context.get());
     obsServ->NotifyObservers(nullptr, "profile-change-teardown", context.get());
     obsServ->NotifyObservers(nullptr, "profile-before-change", context.get());
+    obsServ->NotifyObservers(nullptr, "profile-before-change2", context.get());
   }
 }
 
 NS_IMETHODIMP
 PowerManagerService::Reboot()
 {
   StartForceQuitWatchdog(eHalShutdownMode_Reboot, mWatchdogTimeoutSecs);
   // To synchronize any unsaved user data before rebooting.
--- a/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp
+++ b/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp
@@ -125,16 +125,17 @@ nsProfileDirServiceProvider::Shutdown()
 
   nsCOMPtr<nsIObserverService> observerService =
            do_GetService("@mozilla.org/observer-service;1");
   if (!observerService)
     return NS_ERROR_FAILURE;
 
   NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
   observerService->NotifyObservers(nullptr, "profile-before-change", context.get());
+  observerService->NotifyObservers(nullptr, "profile-before-change2", context.get());
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsProfileDirServiceProvider::nsISupports
 //*****************************************************************************
 
 NS_IMPL_ISUPPORTS1(nsProfileDirServiceProvider,
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -862,16 +862,17 @@ nsXREDirProvider::DoShutdown()
         JSRuntime *rt = nullptr;
         rtsvc->GetRuntime(&rt);
         if (rt)
           ::JS_GC(rt);
       }
 
       // Phase 3: Notify observers of a profile change
       obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist);
+      obsSvc->NotifyObservers(nullptr, "profile-before-change2", kShutdownPersist);
     }
     mProfileNotified = false;
   }
 }
 
 #ifdef XP_WIN
 static nsresult
 GetShellFolderPath(int folder, nsAString& _retval)
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -372,16 +372,17 @@ nsAppShell::ProcessNextNativeEvent(bool 
         nsCOMPtr<nsIObserverService> obsServ =
             mozilla::services::GetObserverService();
         NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
         obsServ->NotifyObservers(nullptr, "quit-application-granted", nullptr);
         obsServ->NotifyObservers(nullptr, "quit-application-forced", nullptr);
         obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context.get());
         obsServ->NotifyObservers(nullptr, "profile-change-teardown", context.get());
         obsServ->NotifyObservers(nullptr, "profile-before-change", context.get());
+        obsServ->NotifyObservers(nullptr, "profile-before-change2", context.get());
         nsCOMPtr<nsIAppStartup> appSvc = do_GetService("@mozilla.org/toolkit/app-startup;1");
         if (appSvc)
             appSvc->Quit(nsIAppStartup::eForceQuit);
         break;
     }
 
     case AndroidGeckoEvent::ACTIVITY_PAUSING: {
         if (curEvent->Flags() == 0) {
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -4574,16 +4574,17 @@ bool nsWindow::ProcessMessage(UINT msg, 
           mozilla::services::GetObserverService();
         NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
         obsServ->NotifyObservers(nullptr, "quit-application-granted", nullptr);
         obsServ->NotifyObservers(nullptr, "quit-application-forced", nullptr);
         obsServ->NotifyObservers(nullptr, "quit-application", nullptr);
         obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context.get());
         obsServ->NotifyObservers(nullptr, "profile-change-teardown", context.get());
         obsServ->NotifyObservers(nullptr, "profile-before-change", context.get());
+        obsServ->NotifyObservers(nullptr, "profile-before-change2", context.get());
         // Then a controlled but very quick exit.
         _exit(0);
       }
       sCanQuit = TRI_UNKNOWN;
       result = true;
       break;
 
     case WM_SYSCOLORCHANGE:
--- a/xpcom/tests/TestHarness.h
+++ b/xpcom/tests/TestHarness.h
@@ -123,16 +123,17 @@ class ScopedXPCOM : public nsIDirectoryS
       if (mProfD) {
         nsCOMPtr<nsIObserverService> os =
           do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
         MOZ_ASSERT(os);
         if (os) {
           MOZ_ALWAYS_TRUE(NS_SUCCEEDED(os->NotifyObservers(nullptr, "profile-change-net-teardown", nullptr)));
           MOZ_ALWAYS_TRUE(NS_SUCCEEDED(os->NotifyObservers(nullptr, "profile-change-teardown", nullptr)));
           MOZ_ALWAYS_TRUE(NS_SUCCEEDED(os->NotifyObservers(nullptr, "profile-before-change", nullptr)));
+          MOZ_ALWAYS_TRUE(NS_SUCCEEDED(os->NotifyObservers(nullptr, "profile-before-change2", nullptr)));
         }
 
         if (NS_FAILED(mProfD->Remove(true))) {
           NS_WARNING("Problem removing profile directory");
         }
 
         mProfD = nullptr;
       }