Bug 709205 - use GetObserverService in dom,docshell; r=bz

This commit is contained in:
Nathan Froyd 2011-12-09 14:35:37 -05:00
parent 1e51cfc1e0
commit 749ca58a65
5 changed files with 10 additions and 10 deletions

View File

@ -4518,7 +4518,7 @@ nsDocShell::Create()
Preferences::AddStrongObserver(this, "browser.xul.error_pages.enabled");
}
nsCOMPtr<nsIObserverService> serv = do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
if (serv) {
const char* msg = mItemType == typeContent ?
NS_WEBNAVIGATION_CREATE : NS_CHROME_WEBNAVIGATION_CREATE;
@ -4535,8 +4535,7 @@ nsDocShell::Destroy()
"Unexpected item type in docshell");
if (!mIsBeingDestroyed) {
nsCOMPtr<nsIObserverService> serv =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
if (serv) {
const char* msg = mItemType == typeContent ?
NS_WEBNAVIGATION_DESTROY : NS_CHROME_WEBNAVIGATION_DESTROY;

View File

@ -6750,7 +6750,7 @@ nsGlobalWindow::IsInModalState()
void
nsGlobalWindow::NotifyDOMWindowDestroyed(nsGlobalWindow* aWindow) {
nsCOMPtr<nsIObserverService> observerService =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
services::GetObserverService();
if (observerService) {
observerService->
NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow),
@ -6799,7 +6799,7 @@ void
nsGlobalWindow::NotifyDOMWindowFrozen(nsGlobalWindow* aWindow) {
if (aWindow && aWindow->IsInnerWindow()) {
nsCOMPtr<nsIObserverService> observerService =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
services::GetObserverService();
if (observerService) {
observerService->
NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow),
@ -6813,7 +6813,7 @@ void
nsGlobalWindow::NotifyDOMWindowThawed(nsGlobalWindow* aWindow) {
if (aWindow && aWindow->IsInnerWindow()) {
nsCOMPtr<nsIObserverService> observerService =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
services::GetObserverService();
if (observerService) {
observerService->
NotifyObservers(static_cast<nsIScriptGlobalObject*>(aWindow),

View File

@ -55,6 +55,7 @@
#include "nsDOMClassInfo.h"
#include "nsCRT.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
#define NS_INTERFACE_PREFIX "nsI"
#define NS_DOM_INTERFACE_PREFIX "nsIDOM"
@ -448,7 +449,7 @@ nsScriptNameSpaceManager::Init()
// Initial filling of the has table has been done.
// Now, listen for changes.
nsCOMPtr<nsIObserverService> serv =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
mozilla::services::GetObserverService();
if (serv) {
serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID, true);

View File

@ -44,6 +44,7 @@
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "mozilla/Services.h"
#ifdef DEBUG
#define ASSERT_OWNING_THREAD() \
@ -267,7 +268,7 @@ LazyIdleThread::ShutdownThread()
if (mThread) {
if (mShutdownMethod == AutomaticShutdown && NS_IsMainThread()) {
nsCOMPtr<nsIObserverService> obs =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
mozilla::services::GetObserverService();
NS_WARN_IF_FALSE(obs, "Failed to get observer service!");
if (obs &&

View File

@ -995,8 +995,7 @@ RuntimeService::Cleanup()
Preferences::UnregisterCallback(PrefCallback, gPrefsToWatch[index], this);
}
nsCOMPtr<nsIObserverService> obs =
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
NS_WARN_IF_FALSE(obs, "Failed to get observer service?!");
if (obs) {