Bug 408808 - "nsProxiedService.h should not use NS_GetProxyForObject" [p=prasad@medhas.org (Prasad Sunkari [prasad]) r=bsmedberg sr=Neil a1.9=schrep]
--- a/xpcom/proxy/public/nsProxiedService.h
+++ b/xpcom/proxy/public/nsProxiedService.h
@@ -34,18 +34,19 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsProxiedService_h__
#define nsProxiedService_h__
-#include "nsIServiceManager.h"
+#include "nsServiceManagerUtils.h"
#include "nsIProxyObjectManager.h"
+#include "nsXPCOMCIDInternal.h"
////////////////////////////////////////////////////////////////////////////////
// NS_WITH_PROXIED_SERVICE: macro to make using services that need to be proxied
// before using them easier.
// Now you can replace this:
// {
// nsresult rv;
// nsCOMPtr<nsIMyService> pIMyService =
@@ -120,19 +121,23 @@ private:
void InitProxy(nsISupports *aObj, const nsIID &aIID,
nsIEventTarget* aTarget, PRBool always, nsresult*rv)
{
PRInt32 proxyType = NS_PROXY_SYNC;
if (always)
proxyType |= NS_PROXY_ALWAYS;
- *rv = NS_GetProxyForObject(aTarget,
- aIID,
- aObj,
- proxyType,
- getter_AddRefs(mProxiedService));
+ nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_GetService(NS_XPCOMPROXY_CONTRACTID, rv);
+ if (NS_FAILED(*rv))
+ return;
+
+ *rv = proxyObjMgr->GetProxyForObject(aTarget,
+ aIID,
+ aObj,
+ proxyType,
+ getter_AddRefs(mProxiedService));
}
nsCOMPtr<nsISupports> mProxiedService;
};
#endif // nsProxiedService_h__