Bug 673017 - Shutdown nsIOService in NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID.
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Thu, 08 Sep 2011 15:42:09 -0400
changeset 76772 1d1143dde4bb02719e47da7488424041c03952ff
parent 76768 a720fe135cfa886f528582c2c8c947e9e1945a3b
child 76773 9c8c4ee78c4e3b2dc68952dac2d91155f019580c
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
bugs673017
milestone9.0a1
Bug 673017 - Shutdown nsIOService in NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID. The nsIOService can use sBlockedScriptRunners and that is deleted by LayoutShutdownObserver reacting to NS_XPCOM_SHUTDOWN_OBSERVER_ID, so we cannot wait for NS_XPCOM_SHUTDOWN_OBSERVER_ID in nsIOService.
netwerk/base/src/nsIOService.cpp
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -229,17 +229,17 @@ nsIOService::Init()
     }
     
     // Register for profile change notifications
     nsCOMPtr<nsIObserverService> observerService =
         mozilla::services::GetObserverService();
     if (observerService) {
         observerService->AddObserver(this, kProfileChangeNetTeardownTopic, PR_TRUE);
         observerService->AddObserver(this, kProfileChangeNetRestoreTopic, PR_TRUE);
-        observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE);
+        observerService->AddObserver(this, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID, PR_TRUE);
         observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, PR_TRUE);
     }
     else
         NS_WARNING("failed to get observer service");
         
     NS_TIME_FUNCTION_MARK("Registered observers");
 
     // Get the allocator ready
@@ -964,17 +964,17 @@ nsIOService::Observe(nsISupports *subjec
         if (mOfflineForProfileChange) {
             mOfflineForProfileChange = PR_FALSE;
             if (!mManageOfflineStatus ||
                 NS_FAILED(TrackNetworkLinkStatusForOffline())) {
                 SetOffline(PR_FALSE);
             }
         } 
     }
-    else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
+    else if (!strcmp(topic, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID)) {
         // Remember we passed XPCOM shutdown notification to prevent any
         // changes of the offline status from now. We must not allow going
         // online after this point.
         mShutdown = PR_TRUE;
 
         SetOffline(PR_TRUE);
 
         // Break circular reference.