From 3d97b38039c044497d431ada8f78cfc29589896e Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 28 Jan 2011 11:26:37 +0000 Subject: [PATCH] backing out changeset b8d97566aa8a (bug 621386) for causing xpcshell orange. a=backout --- dom/ipc/ContentParent.cpp | 38 +++++++++++++------------------------- dom/ipc/ContentParent.h | 2 -- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 668c2b2e2a1c..6f131b908a08 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -165,7 +165,8 @@ ContentParent::ActorDestroy(ActorDestroyReason why) kungFuDeathGrip(static_cast(this)); nsCOMPtr obs(do_GetService("@mozilla.org/observer-service;1")); - Cleanup(); + if (obs) + obs->RemoveObserver(static_cast(this), "xpcom-shutdown"); nsCOMPtr threadInt(do_QueryInterface(NS_GetCurrentThread())); if (threadInt) @@ -340,36 +341,23 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(ContentParent, nsIThreadObserver, nsIDOMGeoPositionCallback) -void -ContentParent::Cleanup() -{ - // remove the global remote preferences observers - nsCOMPtr prefs - (do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (prefs) { - prefs->RemoveObserver("", this); - } - - nsCOMPtr - obs(do_GetService("@mozilla.org/observer-service;1")); - if (obs) { - obs->RemoveObserver(static_cast(this), "xpcom-shutdown"); - obs->RemoveObserver(static_cast(this), "memory-pressure"); - obs->RemoveObserver(static_cast(this), - NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC); - } - - RecvRemoveGeolocationListener(); - RecvRemoveAccelerometerListener(); -} - NS_IMETHODIMP ContentParent::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData) { if (!strcmp(aTopic, "xpcom-shutdown") && mSubprocess) { - Cleanup(); + // remove the global remote preferences observers + nsCOMPtr prefs + (do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) { + if (gSingleton) { + prefs->RemoveObserver("", this); + } + } + + RecvRemoveGeolocationListener(); + Close(); NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess"); } diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index ab16ec8d5277..764c016b4e00 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -105,8 +105,6 @@ protected: private: static ContentParent* gSingleton; - void Cleanup(); - // Hide the raw constructor methods since we don't want client code // using them. using PContentParent::SendPBrowserConstructor;