diff --git a/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp b/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp index b6a97a7d1e1..3c2bd2bbb6c 100644 --- a/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp @@ -134,10 +134,14 @@ nsProxyObjectManager::GetProxyForObject(nsIEventTarget* aTarget, *aProxyObject = nsnull; - nsCOMPtr currentThread; - if (!aTarget) { - currentThread = do_GetCurrentThread(); - aTarget = currentThread.get(); + // handle special values + nsCOMPtr thread; + if (aTarget == NS_PROXY_TO_CURRENT_THREAD) { + thread = do_GetCurrentThread(); + aTarget = thread.get(); + } else if (aTarget == NS_PROXY_TO_MAIN_THREAD) { + thread = do_GetMainThread(); + aTarget = thread.get(); } // check to see if the target is on our thread. If so, just return the @@ -179,12 +183,6 @@ NS_GetProxyForObject(nsIEventTarget *target, nsresult rv; - nsCOMPtr mainThread; - if (target == NS_PROXY_TO_MAIN_THREAD) { - mainThread = do_GetMainThread(); - target = mainThread.get(); - } - // get the proxy object manager // nsCOMPtr proxyObjMgr =