diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 7f021567b7c..ace98b8e712 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -352,35 +352,6 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyProvider, //----------------------------------------------------------------------------- -// Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and -// perform shutdown of the layout modules at that time instead of waiting for -// our module destructor to run. If we do not do this, then we risk holding -// references to objects in other component libraries that have already been -// shutdown (and possibly unloaded if 60709 is ever fixed). - -class LayoutShutdownObserver MOZ_FINAL : public nsIObserver -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIOBSERVER -}; - -NS_IMPL_ISUPPORTS1(LayoutShutdownObserver, nsIObserver) - -NS_IMETHODIMP -LayoutShutdownObserver::Observe(nsISupports *aSubject, - const char *aTopic, - const char16_t *someData) -{ - if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { - Shutdown(); - nsContentUtils::XPCOMShutdown(); - } - return NS_OK; -} - -//----------------------------------------------------------------------------- - static bool gInitialized = false; // Perform our one-time intialization for this module @@ -411,24 +382,6 @@ Initialize() return rv; } - // Add our shutdown observer. - nsCOMPtr observerService = - mozilla::services::GetObserverService(); - - if (observerService) { - LayoutShutdownObserver* observer = new LayoutShutdownObserver(); - - if (!observer) { - Shutdown(); - - return NS_ERROR_OUT_OF_MEMORY; - } - - observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false); - } else { - NS_WARNING("Could not get an observer service. We will leak on shutdown."); - } - #ifdef DEBUG nsStyleContext::AssertStyleStructMaxDifferenceValid(); #endif @@ -1293,6 +1246,8 @@ static const mozilla::Module::CategoryEntry kLayoutCategories[] = { static void LayoutModuleDtor() { + Shutdown(); + nsContentUtils::XPCOMShutdown(); nsScriptSecurityManager::Shutdown(); xpcModuleDtor(); }