Down to the last few patches. default tip
authorBenjamin Smedberg <benjamin@smedbergs.us>
Wed, 04 Jan 2012 12:10:57 -0500
changeset 4 ac5e38072658ef82b7c01909f95715174c521311
parent 3 c1b6d03f23840574cfa2a091a46f53c0e67d6dbc
push id5
push userbsmedberg@mozilla.com
push dateWed, 04 Jan 2012 17:11:05 +0000
Down to the last few patches.
bug675221-partA-xpcom
bug675221-partC-necko
bug675221-partD-urlclassifier
bug675221-partE-domstorage
bug675221-partF-psm
bug675221-partG-define-HAS_STDCALL
series
trychooser-mostlyeverything
--- a/bug675221-partA-xpcom
+++ b/bug675221-partA-xpcom
@@ -1,45 +1,46 @@
 # HG changeset patch
-# Parent fc0c60debaaea204df096d81668de3dac24ca070
+# Parent f268da52217d333b76c02e8219cb6d983a900207
 Bug 675221 part A: replace XPCOM proxies with runanble for code in XPCOM itself, r?bz
 
 diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp
 --- a/xpcom/base/nsConsoleService.cpp
 +++ b/xpcom/base/nsConsoleService.cpp
-@@ -40,95 +40,118 @@
+@@ -40,17 +40,16 @@
   * Maintains a circular buffer of recent messages, and notifies
   * listeners when new messages are logged.
   */
  
  /* Threadsafe. */
  
  #include "nsMemory.h"
  #include "nsIServiceManager.h"
 -#include "nsIProxyObjectManager.h"
  #include "nsCOMArray.h"
  #include "nsThreadUtils.h"
  
  #include "nsConsoleService.h"
  #include "nsConsoleMessage.h"
  #include "nsIClassInfoImpl.h"
  
- using namespace mozilla;
+ #if defined(ANDROID)
+@@ -61,78 +60,103 @@ using namespace mozilla;
  
  NS_IMPL_THREADSAFE_ADDREF(nsConsoleService)
  NS_IMPL_THREADSAFE_RELEASE(nsConsoleService)
  NS_IMPL_CLASSINFO(nsConsoleService, NULL, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID)
  NS_IMPL_QUERY_INTERFACE1_CI(nsConsoleService, nsIConsoleService)
  NS_IMPL_CI_INTERFACE_GETTER1(nsConsoleService, nsIConsoleService)
  
  nsConsoleService::nsConsoleService()
--    : mMessages(nsnull), mCurrent(0), mFull(PR_FALSE), mListening(PR_FALSE), mLock("nsConsoleService.mLock")
+-    : mMessages(nsnull), mCurrent(0), mFull(false), mListening(false), mLock("nsConsoleService.mLock")
 +    : mMessages(nsnull)
 +    , mCurrent(0)
-+    , mFull(PR_FALSE)
++    , mFull(false)
 +    , mLock("nsConsoleService.mLock")
  {
      // XXX grab this from a pref!
      // hm, but worry about circularity, bc we want to be able to report
      // prefs errs...
      mBufferSize = 250;
  }
  
@@ -76,30 +77,31 @@ diff --git a/xpcom/base/nsConsoleService
      // Array elements should be 0 initially for circular buffer algorithm.
      memset(mMessages, 0, mBufferSize * sizeof(nsIConsoleMessage *));
  
 +    mListeners.Init();
 +
      return NS_OK;
  }
  
--static PRBool snapshot_enum_func(nsHashKey *key, void *data, void* closure)
+-static bool snapshot_enum_func(nsHashKey *key, void *data, void* closure)
 +namespace {
++
 +class LogMessageRunnable : public nsRunnable
  {
 -    nsCOMArray<nsIConsoleListener> *array =
 -      reinterpret_cast<nsCOMArray<nsIConsoleListener> *>(closure);
 +public:
 +    LogMessageRunnable(nsIConsoleMessage* message) :
 +        mMessage(message)
 +    { }
  
 -    // Copy each element into the temporary nsCOMArray...
 -    array->AppendObject((nsIConsoleListener*)data);
--    return PR_TRUE;
+-    return true;
 +    void AddListener(nsIConsoleListener* listener) {
 +        mListeners.AppendObject(listener);
 +    }
 +
 +    NS_DECL_NSIRUNNABLE
 +
 +private:
 +    nsCOMPtr<nsIConsoleMessage> mMessage;
@@ -138,66 +140,66 @@ diff --git a/xpcom/base/nsConsoleService
      nsIConsoleMessage *retiredMessage;
  
      NS_ADDREF(message); // early, in case it's same as replaced below.
  
      /*
       * Lock while updating buffer, and while taking snapshot of
       * listeners array.
       */
-@@ -147,46 +170,23 @@ nsConsoleService::LogMessage(nsIConsoleM
+@@ -161,46 +185,22 @@ nsConsoleService::LogMessage(nsIConsoleM
              mCurrent = 0; // wrap around.
-             mFull = PR_TRUE;
+             mFull = true;
          }
  
          /*
           * Copy the listeners into the snapshot array - in case a listener
           * is removed during an Observe(...) notification...
           */
 -        mListeners.Enumerate(snapshot_enum_func, &listenersSnapshot);
-+        mListeners.EnumerateRead(CollectCurrentListeners, r);
++        mListeners.Enumerateread(CollectCurrentListeners, r);
      }
      if (retiredMessage != nsnull)
          NS_RELEASE(retiredMessage);
  
 -    /*
 -     * Iterate through any registered listeners and tell them about
 -     * the message.  We use the mListening flag to guard against
 -     * recursive message logs.  This could sometimes result in
 -     * listeners being skipped because of activity on other threads,
 -     * when we only care about the recursive case.
 -     */
 -    nsCOMPtr<nsIConsoleListener> listener;
 -    PRInt32 snapshotCount = listenersSnapshot.Count();
- 
+-
 -    {
 -        MutexAutoLock lock(mLock);
 -        if (mListening)
 -            return NS_OK;
--        mListening = PR_TRUE;
+-        mListening = true;
 -    }
 -
 -    for (PRInt32 i = 0; i < snapshotCount; i++) {
 -        listenersSnapshot[i]->Observe(message);
 -    }
 -    
 -    {
 -        MutexAutoLock lock(mLock);
--        mListening = PR_FALSE;
+-        mListening = false;
 -    }
 +    NS_DispatchToMainThread(r);
  
      return NS_OK;
  }
  
  NS_IMETHODIMP
  nsConsoleService::LogStringMessage(const PRUnichar *message)
  {
      nsConsoleMessage *msg = new nsConsoleMessage(message);
-@@ -246,73 +246,54 @@ nsConsoleService::GetMessageArray(nsICon
+@@ -260,73 +260,54 @@ nsConsoleService::GetMessageArray(nsICon
      }
      *count = resultSize;
      *messages = messageArray;
  
      return NS_OK;
  }
  
  NS_IMETHODIMP
@@ -290,32 +292,32 @@ diff --git a/xpcom/base/nsConsoleService
      /*
       * Make sure nobody trips into the buffer while it's being reset
       */
      MutexAutoLock lock(mLock);
  
 diff --git a/xpcom/base/nsConsoleService.h b/xpcom/base/nsConsoleService.h
 --- a/xpcom/base/nsConsoleService.h
 +++ b/xpcom/base/nsConsoleService.h
-@@ -39,52 +39,45 @@
-  * nsConsoleService class declaration.
-  */
+@@ -41,52 +41,45 @@
  
  #ifndef __nsconsoleservice_h__
  #define __nsconsoleservice_h__
  
+ #include "mozilla/Attributes.h"
  #include "mozilla/Mutex.h"
+ 
  #include "nsCOMPtr.h"
 -#include "nsHashtable.h"
 +#include "nsInterfaceHashtable.h"
 +#include "nsHashKeys.h"
  
  #include "nsIConsoleService.h"
  
- class nsConsoleService : public nsIConsoleService
+ class nsConsoleService MOZ_FINAL : public nsIConsoleService
  {
  public:
      nsConsoleService();
      nsresult Init();
  
      NS_DECL_ISUPPORTS
      NS_DECL_NSICONSOLESERVICE
  
@@ -331,24 +333,24 @@ diff --git a/xpcom/base/nsConsoleService
  
      // How big?
      PRUint32 mBufferSize;
  
      // Index of slot in mMessages that'll be filled by *next* log message
      PRUint32 mCurrent;
  
      // Is the buffer full? (Has mCurrent wrapped around at least once?)
-     PRBool mFull;
+     bool mFull;
  
      // Listeners to notify whenever a new message is logged.
 -    nsSupportsHashtable mListeners;
 -
 -    // Current listener being notified of a logged error - to prevent
 -    // stack overflows.
--    PRBool mListening;
+-    bool mListening;
 +    nsInterfaceHashtable<nsISupportsHashKey, nsIConsoleListener> mListeners;
  
      // To serialize interesting methods.
      mozilla::Mutex mLock;
  };
  
  #endif /* __nsconsoleservice_h__ */
 diff --git a/xpcom/components/nsCategoryManager.cpp b/xpcom/components/nsCategoryManager.cpp
@@ -479,23 +481,23 @@ diff --git a/xpcom/components/nsCategory
    static nsCategoryManager* gCategoryManager;
  
    nsCategoryManager();
    ~nsCategoryManager();
  
    CategoryNode* get_category(const char* aName);
    void NotifyObservers(const char* aTopic,
 -                       const char* aCategoryName,
-+                       const char* aCategoryName, // Must be a static string
++                       const char* aCategoryName, // must be a static string
                         const char* aEntryName);
  
    PLArenaPool mArena;
    nsClassHashtable<nsDepCharHashKey, CategoryNode> mTable;
    mozilla::Mutex mLock;
-   PRBool mSuppressNotifications;
+   bool mSuppressNotifications;
  };
  
 diff --git a/xpcom/components/nsNativeComponentLoader.cpp b/xpcom/components/nsNativeComponentLoader.cpp
 --- a/xpcom/components/nsNativeComponentLoader.cpp
 +++ b/xpcom/components/nsNativeComponentLoader.cpp
 @@ -59,17 +59,16 @@
  
  #include "nsComponentManager.h"
@@ -646,26 +648,26 @@ diff --git a/xpcom/threads/TimerThread.c
 -                             getter_AddRefs(result));
 -        observerService.swap(result);
 +      nsRefPtr<TimerObserverRunnable> r = new TimerObserverRunnable(this);
 +      if (NS_IsMainThread()) {
 +        r->Run();
        }
 -      // We'll be released at xpcom shutdown
 -      if (observerService) {
--        observerService->AddObserver(this, "sleep_notification", PR_FALSE);
--        observerService->AddObserver(this, "wake_notification", PR_FALSE);
+-        observerService->AddObserver(this, "sleep_notification", false);
+-        observerService->AddObserver(this, "wake_notification", false);
 +      else {
 +        NS_DispatchToMainThread(r);
        }
      }
  
      {
        MonitorAutoLock lock(mMonitor);
-       mInitialized = PR_TRUE;
+       mInitialized = true;
        mMonitor.NotifyAll();
      }
 diff --git a/xpcom/threads/nsThreadPool.cpp b/xpcom/threads/nsThreadPool.cpp
 --- a/xpcom/threads/nsThreadPool.cpp
 +++ b/xpcom/threads/nsThreadPool.cpp
 @@ -31,17 +31,16 @@
   * use your version of this file under the terms of the MPL, indicate your
   * decision by deleting the provisions above and replace them with the notice
deleted file mode 100644
--- a/bug675221-partC-necko
+++ /dev/null
@@ -1,613 +0,0 @@
-# HG changeset patch
-# Parent 4d69a7a144683f6dc876f09ece39be86fb84b288
-
-diff --git a/netwerk/base/src/nsServerSocket.cpp b/netwerk/base/src/nsServerSocket.cpp
---- a/netwerk/base/src/nsServerSocket.cpp
-+++ b/netwerk/base/src/nsServerSocket.cpp
-@@ -30,17 +30,16 @@
-  * use your version of this file under the terms of the MPL, indicate your
-  * decision by deleting the provisions above and replace them with the notice
-  * and other provisions required by the GPL or the LGPL. If you do not delete
-  * 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 ***** */
- 
--#include "nsIProxyObjectManager.h"
- #include "nsIServiceManager.h"
- #include "nsSocketTransport2.h"
- #include "nsServerSocket.h"
- #include "nsProxyRelease.h"
- #include "nsAutoPtr.h"
- #include "nsNetError.h"
- #include "nsNetCID.h"
- #include "prnetdb.h"
-@@ -356,31 +355,118 @@ nsServerSocket::Close()
-         mFD = nsnull;
-       }
-       return NS_OK;
-     }
-   }
-   return PostEvent(this, &nsServerSocket::OnMsgClose);
- }
- 
-+namespace {
-+
-+class ServerSocketListenerProxy : public nsIServerSocketListener
-+{
-+public:
-+  ServerSocketListenerProxy(nsIServerSocketListener* aListener)
-+    : mListener(aListener)
-+    , mTargetThread(do_GetCurrentThread())
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSISERVERSOCKETLISTENER
-+
-+  class OnSocketAcceptedRunnable : public nsRunnable
-+  {
-+  public:
-+    OnSocketAcceptedRunnable(nsIServerSocketListener* aListener,
-+                             nsIServerSocket* aServ,
-+                             nsISocketTransport* aTransport)
-+      : mListener(aListener)
-+      , mServ(aServ)
-+      , mTransport(aTransport)
-+    { }
-+    
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIServerSocketListener> mListener;
-+    nsCOMPtr<nsIServerSocket> mServ;
-+    nsCOMPtr<nsISocketTransport> mTransport;
-+  };
-+
-+  class OnStopListeningRunnable : public nsRunnable
-+  {
-+  public:
-+    OnStopListeningRunnable(nsIServerSocketListener* aListener,
-+                            nsIServerSocket* aServ,
-+                            nsresult aStatus)
-+      : mListener(aListener)
-+      , mServ(aServ)
-+      , mStatus(aStatus)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIServerSocketListener> mListener;
-+    nsCOMPtr<nsIServerSocket> mServ;
-+    nsresult mStatus;
-+  };
-+
-+private:
-+  nsCOMPtr<nsIServerSocketListener> mListener;
-+  nsCOMPtr<nsIEventTarget> mTargetThread;
-+};
-+
-+NS_IMPL_THREADSAFE_ISUPPORTS1(ServerSocketListenerProxy,
-+                              nsIServerSocketListener)
-+
-+NS_IMETHODIMP
-+ServerSocketListenerProxy::OnSocketAccepted(nsIServerSocket* aServ,
-+                                            nsISocketTransport* aTransport)
-+{
-+  nsRefPtr<OnSocketAcceptedRunnable> r =
-+    new OnSocketAcceptedRunnable(mListener, aServ, aTransport);
-+  return mTargetThread->Dispatch(r, NS_DISPATCH_NORMAL);
-+}
-+
-+NS_IMETHODIMP
-+ServerSocketListenerProxy::OnStopListening(nsIServerSocket* aServ,
-+                                           nsresult aStatus)
-+{
-+  nsRefPtr<OnStopListeningRunnable> r =
-+    new OnStopListeningRunnable(mListener, aServ, aStatus);
-+  return mTargetThread->Dispatch(r, NS_DISPATCH_NORMAL);
-+}
-+
-+NS_IMETHODIMP
-+ServerSocketListenerProxy::OnSocketAcceptedRunnable::Run()
-+{
-+  mListener->OnSocketAccepted(mServ, mTransport);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+ServerSocketListenerProxy::OnStopListeningRunnable::Run()
-+{
-+  mListener->OnStopListening(mServ, mStatus);
-+  return NS_OK;
-+}
-+
-+} // anonymous namespace
-+
- NS_IMETHODIMP
- nsServerSocket::AsyncListen(nsIServerSocketListener *aListener)
- {
-   // ensuring mFD implies ensuring mLock
-   NS_ENSURE_TRUE(mFD, NS_ERROR_NOT_INITIALIZED);
-   NS_ENSURE_TRUE(mListener == nsnull, NS_ERROR_IN_PROGRESS);
-   {
-     MutexAutoLock lock(mLock);
--    nsresult rv = NS_GetProxyForObject(NS_PROXY_TO_CURRENT_THREAD,
--                                       NS_GET_IID(nsIServerSocketListener),
--                                       aListener,
--                                       NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
--                                       getter_AddRefs(mListener));
--    if (NS_FAILED(rv))
--      return rv;
-+    mListener = new ServerSocketListenerProxy(aListener);
-     mListenerTarget = NS_GetCurrentThread();
-   }
-   return PostEvent(this, &nsServerSocket::OnMsgAttach);
- }
- 
- NS_IMETHODIMP
- nsServerSocket::GetPort(PRInt32 *aResult)
- {
-diff --git a/netwerk/base/src/nsSocketTransport2.cpp b/netwerk/base/src/nsSocketTransport2.cpp
---- a/netwerk/base/src/nsSocketTransport2.cpp
-+++ b/netwerk/base/src/nsSocketTransport2.cpp
-@@ -55,17 +55,16 @@
- #include "netCore.h"
- #include "prmem.h"
- #include "plstr.h"
- #include "prnetdb.h"
- #include "prerror.h"
- #include "prerr.h"
- 
- #include "nsIServiceManager.h"
--#include "nsIProxyObjectManager.h"
- #include "nsISocketProviderService.h"
- #include "nsISocketProvider.h"
- #include "nsISSLSocketControl.h"
- #include "nsINSSErrorsService.h"
- #include "nsIPipe.h"
- #include "nsIProgrammingLanguage.h"
- #include "nsIClassInfoImpl.h"
- 
-diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp
---- a/netwerk/cache/nsCacheService.cpp
-+++ b/netwerk/cache/nsCacheService.cpp
-@@ -1187,41 +1187,52 @@ nsCacheService::CreateSession(const char
- nsresult
- nsCacheService::EvictEntriesForSession(nsCacheSession * session)
- {
-     NS_ASSERTION(gService, "nsCacheService::gService is null.");
-     return gService->EvictEntriesForClient(session->ClientID()->get(),
-                                  session->StoragePolicy());
- }
- 
-+namespace {
-+
-+class EvictionNotifierRunnable : public nsRunnable
-+{
-+public:
-+    EvictionNotifierRunnable(nsISupports* aSubject)
-+        : mSubject(aSubject)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+private:
-+    nsCOMPtr<nsISupports> mSubject;
-+};
-+
-+NS_IMETHODIMP
-+EvictionNotifierRunnable::Run()
-+{
-+    nsCOMPtr<nsIObserverService> obsSvc =
-+        mozilla::services::GetObserverService();
-+    if (obsSvc) {
-+        obsSvc->NotifyObservers(mSubject,
-+                                NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID,
-+                                nsnull);
-+    }
-+    return NS_OK;
-+}
-+
-+} // anonymous namespace
- 
- nsresult
- nsCacheService::EvictEntriesForClient(const char *          clientID,
-                                       nsCacheStoragePolicy  storagePolicy)
- {
--    if (this == nsnull) return NS_ERROR_NOT_AVAILABLE; // XXX eh?
--
--    nsCOMPtr<nsIObserverService> obsSvc =
--        mozilla::services::GetObserverService();
--    if (obsSvc) {
--        // Proxy to the UI thread since the observer service isn't thredsafe.
--        // We use an async proxy, since this it's not important whether this
--        // notification happens before or after the actual eviction.
--
--        nsCOMPtr<nsIObserverService> obsProxy;
--        NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                             NS_GET_IID(nsIObserverService), obsSvc,
--                             NS_PROXY_ASYNC, getter_AddRefs(obsProxy));
--
--        if (obsProxy) {
--            obsProxy->NotifyObservers(this,
--                                      NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID,
--                                      nsnull);
--        }
--    }
-+    nsRefPtr<EvictionNotifierRunnable> r = new EvictionNotifierRunnable(this);
-+    NS_DispatchToMainThread(r);
- 
-     nsCacheServiceAutoLock lock;
-     nsresult res = NS_OK;
- 
- #ifdef NECKO_DISK_CACHE
-     if (storagePolicy == nsICache::STORE_ANYWHERE ||
-         storagePolicy == nsICache::STORE_ON_DISK) {
- 
-diff --git a/netwerk/cache/nsCacheService.h b/netwerk/cache/nsCacheService.h
---- a/netwerk/cache/nsCacheService.h
-+++ b/netwerk/cache/nsCacheService.h
-@@ -48,17 +48,16 @@
- #include "nsICacheService.h"
- #include "nsCacheSession.h"
- #include "nsCacheDevice.h"
- #include "nsCacheEntry.h"
- 
- #include "prthread.h"
- #include "nsIObserver.h"
- #include "nsString.h"
--#include "nsProxiedService.h"
- #include "nsTArray.h"
- #include "mozilla/CondVar.h"
- #include "mozilla/Mutex.h"
- 
- class nsCacheRequest;
- class nsCacheProfilePrefObserver;
- class nsDiskCacheDevice;
- class nsMemoryCacheDevice;
-diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp
---- a/netwerk/dns/nsDNSService2.cpp
-+++ b/netwerk/dns/nsDNSService2.cpp
-@@ -34,27 +34,27 @@
-  * the terms of any one of the MPL, the GPL or the LGPL.
-  *
-  * ***** END LICENSE BLOCK ***** */
- 
- #include "nsDNSService2.h"
- #include "nsIDNSRecord.h"
- #include "nsIDNSListener.h"
- #include "nsICancelable.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIPrefService.h"
- #include "nsIPrefBranch.h"
- #include "nsIPrefBranch2.h"
- #include "nsIServiceManager.h"
- #include "nsReadableUtils.h"
- #include "nsString.h"
- #include "nsAutoPtr.h"
- #include "nsNetCID.h"
- #include "nsNetError.h"
- #include "nsDNSPrefetch.h"
-+#include "nsThreadUtils.h"
- #include "nsIProtocolProxyService.h"
- #include "prsystem.h"
- #include "prnetdb.h"
- #include "prmon.h"
- #include "prio.h"
- #include "plstr.h"
- #include "nsIOService.h"
- 
-@@ -464,16 +464,77 @@ nsDNSService::Shutdown()
-         res = mResolver;
-         mResolver = nsnull;
-     }
-     if (res)
-         res->Shutdown();
-     return NS_OK;
- }
- 
-+namespace {
-+
-+class DNSListenerProxy : public nsIDNSListener
-+{
-+public:
-+  DNSListenerProxy(nsIDNSListener* aListener, nsIEventTarget* aTargetThread)
-+    : mListener(aListener)
-+    , mTargetThread(aTargetThread)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIDNSLISTENER
-+
-+  class OnLookupCompleteRunnable : public nsRunnable
-+  {
-+  public:
-+    OnLookupCompleteRunnable(nsIDNSListener* aListener,
-+                             nsICancelable* aRequest,
-+                             nsIDNSRecord* aRecord,
-+                             nsresult aStatus)
-+      : mListener(aListener)
-+      , mRequest(aRequest)
-+      , mRecord(aRecord)
-+      , mStatus(aStatus)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIDNSListener> mListener;
-+    nsCOMPtr<nsICancelable> mRequest;
-+    nsCOMPtr<nsIDNSRecord> mRecord;
-+    nsresult mStatus;
-+  };
-+
-+private:
-+  nsCOMPtr<nsIDNSListener> mListener;
-+  nsCOMPtr<nsIEventTarget> mTargetThread;
-+};
-+
-+NS_IMPL_THREADSAFE_ISUPPORTS1(DNSListenerProxy, nsIDNSListener)
-+
-+NS_IMETHODIMP
-+DNSListenerProxy::OnLookupComplete(nsICancelable* aRequest,
-+                                   nsIDNSRecord* aRecord,
-+                                   nsresult aStatus)
-+{
-+  nsRefPtr<OnLookupCompleteRunnable> r =
-+    new OnLookupCompleteRunnable(mListener, aRequest, aRecord, aStatus);
-+  return mTargetThread->Dispatch(r, NS_DISPATCH_NORMAL);
-+}
-+
-+NS_IMETHODIMP
-+DNSListenerProxy::OnLookupCompleteRunnable::Run()
-+{
-+  mListener->OnLookupComplete(mRequest, mRecord, mStatus);
-+  return NS_OK;
-+}
-+
-+} // anonymous namespace
-+
- NS_IMETHODIMP
- nsDNSService::AsyncResolve(const nsACString  &hostname,
-                            PRUint32           flags,
-                            nsIDNSListener    *listener,
-                            nsIEventTarget    *target,
-                            nsICancelable    **result)
- {
-     // grab reference to global host resolver and IDN service.  beware
-@@ -496,25 +557,18 @@ nsDNSService::AsyncResolve(const nsACStr
- 
-     nsresult rv;
-     nsCAutoString hostACE;
-     if (idn && !IsASCII(hostname)) {
-         if (NS_SUCCEEDED(idn->ConvertUTF8toACE(hostname, hostACE)))
-             hostPtr = &hostACE;
-     }
- 
--    nsCOMPtr<nsIDNSListener> listenerProxy;
-     if (target) {
--        rv = NS_GetProxyForObject(target,
--                                  NS_GET_IID(nsIDNSListener),
--                                  listener,
--                                  NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
--                                  getter_AddRefs(listenerProxy));
--        if (NS_FAILED(rv)) return rv;
--        listener = listenerProxy;
-+      listener = new DNSListenerProxy(listener, target);
-     }
- 
-     PRUint16 af = GetAFForLookup(*hostPtr, flags);
- 
-     nsDNSAsyncRequest *req =
-             new nsDNSAsyncRequest(res, *hostPtr, listener, flags, af);
-     if (!req)
-         return NS_ERROR_OUT_OF_MEMORY;
-diff --git a/netwerk/protocol/ftp/nsFTPChannel.cpp b/netwerk/protocol/ftp/nsFTPChannel.cpp
---- a/netwerk/protocol/ftp/nsFTPChannel.cpp
-+++ b/netwerk/protocol/ftp/nsFTPChannel.cpp
-@@ -39,17 +39,16 @@
- #include "nsFTPChannel.h"
- #include "nsFtpConnectionThread.h"  // defines nsFtpState
- 
- #include "nsIStreamListener.h"
- #include "nsIServiceManager.h"
- #include "nsThreadUtils.h"
- #include "nsNetUtil.h"
- #include "nsMimeTypes.h"
--#include "nsIProxyObjectManager.h"
- #include "nsReadableUtils.h"
- #include "nsIPrefService.h"
- #include "nsIPrefBranch.h"
- #include "nsIStreamConverterService.h"
- #include "nsISocketTransport.h"
- #include "nsURLHelper.h"
- 
- #if defined(PR_LOGGING)
-@@ -176,24 +175,76 @@ nsFtpChannel::GetStatusArg(nsresult stat
- void
- nsFtpChannel::OnCallbacksChanged()
- {
-     mFTPEventSink = nsnull;
- }
- 
- //-----------------------------------------------------------------------------
- 
-+namespace {
-+
-+class FTPEventSinkProxy : public nsIFTPEventSink
-+{
-+public:
-+    FTPEventSinkProxy(nsIFTPEventSink* aTarget)
-+        : mTarget(aTarget)
-+        , mTargetThread(do_GetCurrentThread())
-+    { }
-+        
-+    NS_DECL_ISUPPORTS
-+    NS_DECL_NSIFTPEVENTSINK
-+
-+    class OnFTPControlLogRunnable : public nsRunnable
-+    {
-+    public:
-+        OnFTPControlLogRunnable(nsIFTPEventSink* aTarget,
-+                                PRBool aServer,
-+                                const char* aMessage)
-+            : mTarget(aTarget)
-+            , mServer(aServer)
-+            , mMessage(aMessage)
-+        { }
-+
-+        NS_DECL_NSIRUNNABLE
-+
-+    private:
-+        nsCOMPtr<nsIFTPEventSink> mTarget;
-+        PRBool mServer;
-+        nsCString mMessage;
-+    };
-+
-+private:
-+    nsCOMPtr<nsIFTPEventSink> mTarget;
-+    nsCOMPtr<nsIThread> mTargetThread;
-+};
-+
-+NS_IMPL_THREADSAFE_ISUPPORTS1(FTPEventSinkProxy, nsIFTPEventSink)
-+
-+NS_IMETHODIMP
-+FTPEventSinkProxy::OnFTPControlLog(PRBool aServer, const char* aMsg)
-+{
-+    nsRefPtr<OnFTPControlLogRunnable> r =
-+        new OnFTPControlLogRunnable(mTarget, aServer, aMsg);
-+    return mTargetThread->Dispatch(r, NS_DISPATCH_NORMAL);
-+}
-+
-+NS_IMETHODIMP
-+FTPEventSinkProxy::OnFTPControlLogRunnable::Run()
-+{
-+    mTarget->OnFTPControlLog(mServer, mMessage.get());
-+    return NS_OK;
-+}
-+
-+} // anonymous namespace
-+
- void
- nsFtpChannel::GetFTPEventSink(nsCOMPtr<nsIFTPEventSink> &aResult)
- {
-     if (!mFTPEventSink) {
-         nsCOMPtr<nsIFTPEventSink> ftpSink;
-         GetCallback(ftpSink);
-         if (ftpSink) {
--            NS_GetProxyForObject(NS_PROXY_TO_CURRENT_THREAD,
--                                 NS_GET_IID(nsIFTPEventSink),
--                                 ftpSink,
--                                 NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
--                                 getter_AddRefs(mFTPEventSink));
-+            mFTPEventSink = new FTPEventSinkProxy(ftpSink);
-         }
-     }
-     aResult = mFTPEventSink;
- }
-diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h
---- a/netwerk/protocol/http/nsHttpHandler.h
-+++ b/netwerk/protocol/http/nsHttpHandler.h
-@@ -49,17 +49,16 @@
- #include "nsCOMPtr.h"
- #include "nsWeakReference.h"
- 
- #include "nsIHttpProtocolHandler.h"
- #include "nsIProtocolProxyService.h"
- #include "nsIIOService.h"
- #include "nsIObserver.h"
- #include "nsIObserverService.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIPrivateBrowsingService.h"
- #include "nsIStreamConverterService.h"
- #include "nsICacheSession.h"
- #include "nsICookieService.h"
- #include "nsIIDNService.h"
- #include "nsITimer.h"
- #include "nsIStrictTransportSecurityService.h"
- 
-diff --git a/netwerk/test/TestSocketTransport.cpp b/netwerk/test/TestSocketTransport.cpp
---- a/netwerk/test/TestSocketTransport.cpp
-+++ b/netwerk/test/TestSocketTransport.cpp
-@@ -39,17 +39,16 @@
- #include "nsIComponentRegistrar.h"
- #include "nsPISocketTransportService.h"
- #include "nsISocketTransport.h"
- #include "nsIAsyncInputStream.h"
- #include "nsIAsyncOutputStream.h"
- #include "nsIProgressEventSink.h"
- #include "nsIInterfaceRequestor.h"
- #include "nsIInterfaceRequestorUtils.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIRequest.h"
- #include "nsIServiceManager.h"
- #include "nsIComponentManager.h"
- #include "nsCOMPtr.h"
- #include "nsMemory.h"
- #include "nsStringAPI.h"
- #include "nsIDNSService.h"
- #include "nsIFileStreams.h"
-diff --git a/netwerk/test/TestStreamChannel.cpp b/netwerk/test/TestStreamChannel.cpp
---- a/netwerk/test/TestStreamChannel.cpp
-+++ b/netwerk/test/TestStreamChannel.cpp
-@@ -37,17 +37,16 @@
- 
- #include "TestCommon.h"
- #include "nsIComponentRegistrar.h"
- #include "nsIStreamTransportService.h"
- #include "nsIAsyncInputStream.h"
- #include "nsIProgressEventSink.h"
- #include "nsIInterfaceRequestor.h"
- #include "nsIInterfaceRequestorUtils.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIRequest.h"
- #include "nsIServiceManager.h"
- #include "nsIComponentManager.h"
- #include "nsCOMPtr.h"
- #include "nsMemory.h"
- #include "nsStringAPI.h"
- #include "nsIFileStreams.h"
- #include "nsIStreamListener.h"
-diff --git a/netwerk/test/TestStreamPump.cpp b/netwerk/test/TestStreamPump.cpp
---- a/netwerk/test/TestStreamPump.cpp
-+++ b/netwerk/test/TestStreamPump.cpp
-@@ -37,17 +37,16 @@
- 
- #include "TestCommon.h"
- #include "nsIComponentRegistrar.h"
- #include "nsIStreamTransportService.h"
- #include "nsIAsyncInputStream.h"
- #include "nsIProgressEventSink.h"
- #include "nsIInterfaceRequestor.h"
- #include "nsIInterfaceRequestorUtils.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIRequest.h"
- #include "nsIServiceManager.h"
- #include "nsIComponentManager.h"
- #include "nsISeekableStream.h"
- #include "nsCOMPtr.h"
- #include "nsMemory.h"
- #include "nsStringAPI.h"
- #include "nsIFileStreams.h"
-diff --git a/netwerk/test/TestStreamTransport.cpp b/netwerk/test/TestStreamTransport.cpp
---- a/netwerk/test/TestStreamTransport.cpp
-+++ b/netwerk/test/TestStreamTransport.cpp
-@@ -37,17 +37,16 @@
- 
- #include "TestCommon.h"
- #include "nsIComponentRegistrar.h"
- #include "nsIStreamTransportService.h"
- #include "nsIAsyncInputStream.h"
- #include "nsIProgressEventSink.h"
- #include "nsIInterfaceRequestor.h"
- #include "nsIInterfaceRequestorUtils.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIRequest.h"
- #include "nsIServiceManager.h"
- #include "nsIComponentManager.h"
- #include "nsCOMPtr.h"
- #include "nsMemory.h"
- #include "nsStringAPI.h"
- #include "nsIFileStreams.h"
- #include "nsIStreamListener.h"
deleted file mode 100644
--- a/bug675221-partD-urlclassifier
+++ /dev/null
@@ -1,895 +0,0 @@
-# HG changeset patch
-# Parent c6bdd20bef8fc79b5ff3e03dc422cf37a317847c
-Bug 675221 part D - Fix up URL classifier to stop using XPCOM proxies, r?dcamp
-
-diff --git a/toolkit/components/url-classifier/Makefile.in b/toolkit/components/url-classifier/Makefile.in
---- a/toolkit/components/url-classifier/Makefile.in
-+++ b/toolkit/components/url-classifier/Makefile.in
-@@ -56,16 +56,17 @@ XPIDLSRCS = \
-   nsIUrlClassifierUtils.idl \
-   nsIUrlListManager.idl \
-   $(NULL)
- 
- CPPSRCS = \
-   nsUrlClassifierDBService.cpp \
-   nsUrlClassifierStreamUpdater.cpp \
-   nsUrlClassifierUtils.cpp \
-+  nsUrlClassifierProxies.cpp \
-   $(NULL)
- 
- LOCAL_INCLUDES = \
-   -I$(srcdir)/../build \
-   $(SQLITE_CFLAGS) \
-   $(NULL)
- 
- EXTRA_COMPONENTS = \
-diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
---- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
-+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
-@@ -54,22 +54,22 @@
- #include "nsIDirectoryService.h"
- #include "nsIKeyModule.h"
- #include "nsIObserverService.h"
- #include "nsIPermissionManager.h"
- #include "nsIPrefBranch.h"
- #include "nsIPrefBranch2.h"
- #include "nsIPrefService.h"
- #include "nsIProperties.h"
--#include "nsIProxyObjectManager.h"
- #include "nsToolkitCompsCID.h"
- #include "nsIUrlClassifierUtils.h"
- #include "nsIRandomGenerator.h"
- #include "nsUrlClassifierDBService.h"
- #include "nsUrlClassifierUtils.h"
-+#include "nsUrlClassifierProxies.h"
- #include "nsURILoader.h"
- #include "nsString.h"
- #include "nsReadableUtils.h"
- #include "nsTArray.h"
- #include "nsNetUtil.h"
- #include "nsNetCID.h"
- #include "nsThreadUtils.h"
- #include "nsXPCOMStrings.h"
-@@ -176,18 +176,17 @@ static const PRLogModuleInfo *gUrlClassi
- #define UPDATE_DELAY_TIME           "urlclassifier.updatetime"
- #define UPDATE_DELAY_TIME_DEFAULT   60
- 
- class nsUrlClassifierDBServiceWorker;
- 
- // Singleton instance.
- static nsUrlClassifierDBService* sUrlClassifierDBService;
- 
--// Thread that we do the updates on.
--static nsIThread* gDbBackgroundThread = nsnull;
-+nsIThread* nsUrlClassifierDBService::gDbBackgroundThread = nsnull;
- 
- // Once we've committed to shutting down, don't do work in the background
- // thread.
- static PRBool gShuttingDownThread = PR_FALSE;
- 
- static PRInt32 gFreshnessGuarantee = CONFIRM_AGE_DEFAULT_SEC;
- 
- static PRInt32 gUpdateCacheSize = UPDATE_CACHE_SIZE_DEFAULT;
-@@ -3915,22 +3914,17 @@ nsUrlClassifierDBService::Init()
- 
-   rv = mWorker->Init(gethashNoise);
-   if (NS_FAILED(rv)) {
-     mWorker = nsnull;
-     return rv;
-   }
- 
-   // Proxy for calling the worker on the background thread
--  rv = NS_GetProxyForObject(gDbBackgroundThread,
--                            NS_GET_IID(nsIUrlClassifierDBServiceWorker),
--                            mWorker,
--                            NS_PROXY_ASYNC,
--                            getter_AddRefs(mWorkerProxy));
--  NS_ENSURE_SUCCESS(rv, rv);
-+  mWorkerProxy = new UrlClassifierDBServiceWorkerProxy(mWorker);
- 
-   mCompleters.Init();
- 
-   // Add an observer for shutdown
-   nsCOMPtr<nsIObserverService> observerService =
-       mozilla::services::GetObserverService();
-   if (!observerService)
-     return NS_ERROR_FAILURE;
-@@ -4033,47 +4027,36 @@ nsUrlClassifierDBService::LookupURI(nsIU
-   // Create an nsUrlClassifierLookupCallback object.  This object will
-   // take care of confirming partial hash matches if necessary before
-   // calling the client's callback.
-   nsCOMPtr<nsIUrlClassifierLookupCallback> callback =
-     new nsUrlClassifierLookupCallback(this, c);
-   if (!callback)
-     return NS_ERROR_OUT_OF_MEMORY;
- 
--  nsCOMPtr<nsIUrlClassifierLookupCallback> proxyCallback;
--  // The proxy callback uses the current thread.
--  rv = NS_GetProxyForObject(NS_PROXY_TO_CURRENT_THREAD,
--                            NS_GET_IID(nsIUrlClassifierLookupCallback),
--                            callback,
--                            NS_PROXY_ASYNC,
--                            getter_AddRefs(proxyCallback));
--  NS_ENSURE_SUCCESS(rv, rv);
-+  nsCOMPtr<nsIUrlClassifierLookupCallback> proxyCallback =
-+    new UrlClassifierLookupCallbackProxy(callback);
- 
-   // Queue this lookup and call the lookup function to flush the queue if
-   // necessary.
-   rv = mWorker->QueueLookup(key, proxyCallback);
-   NS_ENSURE_SUCCESS(rv, rv);
- 
-   return mWorkerProxy->Lookup(EmptyCString(), nsnull);
- }
- 
- NS_IMETHODIMP
- nsUrlClassifierDBService::GetTables(nsIUrlClassifierCallback* c)
- {
-   NS_ENSURE_TRUE(gDbBackgroundThread, NS_ERROR_NOT_INITIALIZED);
- 
-   nsresult rv;
-   // The proxy callback uses the current thread.
--  nsCOMPtr<nsIUrlClassifierCallback> proxyCallback;
--  rv = NS_GetProxyForObject(NS_PROXY_TO_CURRENT_THREAD,
--                            NS_GET_IID(nsIUrlClassifierCallback),
--                            c,
--                            NS_PROXY_ASYNC,
--                            getter_AddRefs(proxyCallback));
--  NS_ENSURE_SUCCESS(rv, rv);
-+  nsCOMPtr<nsIUrlClassifierCallback> proxyCallback =
-+    new UrlClassifierCallbackProxy(c);
- 
-   return mWorkerProxy->GetTables(proxyCallback);
- }
- 
- NS_IMETHODIMP
- nsUrlClassifierDBService::SetHashCompleter(const nsACString &tableName,
-                                            nsIUrlClassifierHashCompleter *completer)
- {
-@@ -4098,23 +4081,18 @@ nsUrlClassifierDBService::BeginUpdate(ns
-   if (mInUpdate)
-     return NS_ERROR_NOT_AVAILABLE;
- 
-   mInUpdate = PR_TRUE;
- 
-   nsresult rv;
- 
-   // The proxy observer uses the current thread
--  nsCOMPtr<nsIUrlClassifierUpdateObserver> proxyObserver;
--  rv = NS_GetProxyForObject(NS_PROXY_TO_CURRENT_THREAD,
--                            NS_GET_IID(nsIUrlClassifierUpdateObserver),
--                            observer,
--                            NS_PROXY_ASYNC,
--                            getter_AddRefs(proxyObserver));
--  NS_ENSURE_SUCCESS(rv, rv);
-+  nsCOMPtr<nsIUrlClassifierUpdateObserver> proxyObserver =
-+    new UrlClassifierUpdateObserverProxy(observer);
- 
-   return mWorkerProxy->BeginUpdate(proxyObserver, updateTables, clientKey);
- }
- 
- NS_IMETHODIMP
- nsUrlClassifierDBService::BeginStream(const nsACString &table,
-                                       const nsACString &serverMAC)
- {
-@@ -4279,8 +4257,15 @@ nsUrlClassifierDBService::Shutdown()
- 
-   nsIThread *backgroundThread = gDbBackgroundThread;
-   gDbBackgroundThread = nsnull;
-   backgroundThread->Shutdown();
-   NS_RELEASE(backgroundThread);
- 
-   return NS_OK;
- }
-+
-+nsIThread*
-+nsUrlClassifierDBService::BackgroundThread()
-+{
-+  return gDbBackgroundThread;
-+}
-+
-diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.h b/toolkit/components/url-classifier/nsUrlClassifierDBService.h
---- a/toolkit/components/url-classifier/nsUrlClassifierDBService.h
-+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.h
-@@ -55,16 +55,17 @@
- 
- // The hash length of a partial hash entry.
- #define PARTIAL_LENGTH 4
- 
- // The hash length of a complete hash entry.
- #define COMPLETE_LENGTH 32
- 
- class nsUrlClassifierDBServiceWorker;
-+class nsIThread;
- 
- // This is a proxy class that just creates a background thread and delagates
- // calls to the background thread.
- class nsUrlClassifierDBService : public nsIUrlClassifierDBService,
-                                  public nsIURIClassifier,
-                                  public nsIObserver
- {
- public:
-@@ -81,31 +82,33 @@ public:
-   NS_DECL_NSIURLCLASSIFIERDBSERVICE
-   NS_DECL_NSIURICLASSIFIER
-   NS_DECL_NSIOBSERVER
- 
-   PRBool GetCompleter(const nsACString& tableName,
-                       nsIUrlClassifierHashCompleter** completer);
-   nsresult CacheCompletions(nsTArray<nsUrlClassifierLookupResult> *results);
- 
-+  static nsIThread* BackgroundThread();
-+
- private:
-   // No subclassing
-   ~nsUrlClassifierDBService();
- 
-   // Disallow copy constructor
-   nsUrlClassifierDBService(nsUrlClassifierDBService&);
- 
-   nsresult LookupURI(nsIURI* uri, nsIUrlClassifierCallback* c,
-                      PRBool forceCheck, PRBool *didCheck);
- 
-   // Close db connection and join the background thread if it exists. 
-   nsresult Shutdown();
-   
-   nsCOMPtr<nsUrlClassifierDBServiceWorker> mWorker;
--  nsCOMPtr<nsUrlClassifierDBServiceWorker> mWorkerProxy;
-+  nsCOMPtr<nsIUrlClassifierDBServiceWorker> mWorkerProxy;
- 
-   nsInterfaceHashtable<nsCStringHashKey, nsIUrlClassifierHashCompleter> mCompleters;
- 
-   // TRUE if the nsURIClassifier implementation should check for malware
-   // uris on document loads.
-   PRBool mCheckMalware;
- 
-   // TRUE if the nsURIClassifier implementation should check for phishing
-@@ -115,13 +118,16 @@ private:
-   // TRUE if a BeginUpdate() has been called without an accompanying
-   // CancelUpdate()/FinishUpdate().  This is used to prevent competing
-   // updates, not to determine whether an update is still being
-   // processed.
-   PRBool mInUpdate;
- 
-   // The list of tables that can use the default hash completer object.
-   nsTArray<nsCString> mGethashWhitelist;
-+
-+  // Thread that we do the updates on.
-+  static nsIThread* gDbBackgroundThread;
- };
- 
- NS_DEFINE_STATIC_IID_ACCESSOR(nsUrlClassifierDBService, NS_URLCLASSIFIERDBSERVICE_CID)
- 
- #endif // nsUrlClassifierDBService_h_
-diff --git a/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp b/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp
-new file mode 100644
---- /dev/null
-+++ b/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp
-@@ -0,0 +1,307 @@
-+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-+/* ***** BEGIN LICENSE BLOCK *****
-+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-+ *
-+ * The contents of this file are subject to the Mozilla Public License Version
-+ * 1.1 (the "License"); you may not use this file except in compliance with
-+ * the License. You may obtain a copy of the License at
-+ * http://www.mozilla.org/MPL/
-+ *
-+ * Software distributed under the License is distributed on an "AS IS" basis,
-+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-+ * for the specific language governing rights and limitations under the
-+ * License.
-+ *
-+ * The Original Code is Mozilla Firefox.
-+ *
-+ * The Initial Developer of the Original Code is
-+ * the Mozilla Foundation <http://www.mozilla.org>.
-+ * Portions created by the Initial Developer are Copyright (C) 2011
-+ * the Initial Developer. All Rights Reserved.
-+ *
-+ * Contributor(s):
-+ *
-+ * Alternatively, the contents of this file may be used under the terms of
-+ * either the GNU General Public License Version 2 or later (the "GPL"), or
-+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-+ * in which case the provisions of the GPL or the LGPL are applicable instead
-+ * of those above. If you wish to allow use of your version of this file only
-+ * under the terms of either the GPL or the LGPL, and not to allow others to
-+ * use your version of this file under the terms of the MPL, indicate your
-+ * decision by deleting the provisions above and replace them with the notice
-+ * and other provisions required by the GPL or the LGPL. If you do not delete
-+ * 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 ***** */
-+
-+#include "nsUrlClassifierProxies.h"
-+#include "nsUrlClassifierDBService.h"
-+
-+static nsresult
-+DispatchToWorkerThread(nsIRunnable* r)
-+{
-+  nsIThread* t = nsUrlClassifierDBService::BackgroundThread();
-+  if (!t)
-+    return NS_ERROR_FAILURE;
-+
-+  return t->Dispatch(r, NS_DISPATCH_NORMAL);
-+}
-+
-+NS_IMPL_THREADSAFE_ISUPPORTS1(UrlClassifierDBServiceWorkerProxy,
-+                              nsIUrlClassifierDBServiceWorker)
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::Lookup(const nsACString& aSpec,
-+                                          nsIUrlClassifierCallback* aCB)
-+{
-+  nsCOMPtr<nsIRunnable> r = new LookupRunnable(mTarget, aSpec, aCB);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::LookupRunnable::Run()
-+{
-+  mTarget->Lookup(mSpec, mCB);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::GetTables(nsIUrlClassifierCallback* aCB)
-+{
-+  nsCOMPtr<nsIRunnable> r = new GetTablesRunnable(mTarget, aCB);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::GetTablesRunnable::Run()
-+{
-+  mTarget->GetTables(mCB);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::SetHashCompleter
-+  (const nsACString&, nsIUrlClassifierHashCompleter*)
-+{
-+  NS_NOTREACHED("This method should not be called!");
-+  return NS_ERROR_NOT_IMPLEMENTED;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::BeginUpdate
-+  (nsIUrlClassifierUpdateObserver* aUpdater,
-+   const nsACString& aTables,
-+   const nsACString& aClientKey)
-+{
-+  nsCOMPtr<nsIRunnable> r = new BeginUpdateRunnable(mTarget, aUpdater,
-+                                                    aTables, aClientKey);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::BeginUpdateRunnable::Run()
-+{
-+  mTarget->BeginUpdate(mUpdater, mTables, mClientKey);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::BeginStream(const nsACString& aTable,
-+                                               const nsACString& aServerMAC)
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    new BeginStreamRunnable(mTarget, aTable, aServerMAC);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::BeginStreamRunnable::Run()
-+{
-+  mTarget->BeginStream(mTable, mServerMAC);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::UpdateStream(const nsACString& aUpdateChunk)
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    new UpdateStreamRunnable(mTarget, aUpdateChunk);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::UpdateStreamRunnable::Run()
-+{
-+  mTarget->UpdateStream(mUpdateChunk);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::FinishStream()
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    NS_NewRunnableMethod(mTarget,
-+                         &nsIUrlClassifierDBServiceWorker::FinishStream);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::FinishUpdate()
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    NS_NewRunnableMethod(mTarget,
-+                         &nsIUrlClassifierDBServiceWorker::FinishUpdate);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::CancelUpdate()
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    NS_NewRunnableMethod(mTarget,
-+                         &nsIUrlClassifierDBServiceWorker::CancelUpdate);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::ResetDatabase()
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    NS_NewRunnableMethod(mTarget,
-+                         &nsIUrlClassifierDBServiceWorker::ResetDatabase);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::CloseDb()
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    NS_NewRunnableMethod(mTarget,
-+                         &nsIUrlClassifierDBServiceWorker::CloseDb);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::CacheCompletions(nsTArray<nsUrlClassifierLookupResult>* aEntries)
-+{
-+  nsCOMPtr<nsIRunnable> r = new CacheCompletionsRunnable(mTarget, aEntries);
-+  return DispatchToWorkerThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierDBServiceWorkerProxy::CacheCompletionsRunnable::Run()
-+{
-+  mTarget->CacheCompletions(mEntries);
-+  return NS_OK;
-+}
-+
-+NS_IMPL_THREADSAFE_ISUPPORTS1(UrlClassifierLookupCallbackProxy,
-+                              nsIUrlClassifierLookupCallback)
-+
-+NS_IMETHODIMP
-+UrlClassifierLookupCallbackProxy::LookupComplete
-+  (nsTArray<nsUrlClassifierLookupResult>* aResults)
-+{
-+  nsCOMPtr<nsIRunnable> r = new LookupCompleteRunnable(mTarget, aResults);
-+  return NS_DispatchToMainThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierLookupCallbackProxy::LookupCompleteRunnable::Run()
-+{
-+  mTarget->LookupComplete(mResults);
-+  return NS_OK;
-+}
-+
-+NS_IMPL_THREADSAFE_ISUPPORTS1(UrlClassifierCallbackProxy,
-+                              nsIUrlClassifierCallback)
-+
-+NS_IMETHODIMP
-+UrlClassifierCallbackProxy::HandleEvent(const nsACString& aValue)
-+{
-+  nsCOMPtr<nsIRunnable> r = new HandleEventRunnable(mTarget, aValue);
-+  return NS_DispatchToMainThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierCallbackProxy::HandleEventRunnable::Run()
-+{
-+  mTarget->HandleEvent(mValue);
-+  return NS_OK;
-+}
-+
-+NS_IMPL_THREADSAFE_ISUPPORTS1(UrlClassifierUpdateObserverProxy,
-+                              nsIUrlClassifierUpdateObserver)
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::UpdateUrlRequested
-+  (const nsACString& aURL,
-+   const nsACString& aTable,
-+   const nsACString& aServerMAC)
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    new UpdateUrlRequestedRunnable(mTarget, aURL, aTable, aServerMAC);
-+  return NS_DispatchToMainThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::UpdateUrlRequestedRunnable::Run()
-+{
-+  mTarget->UpdateUrlRequested(mURL, mTable, mServerMAC);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::RekeyRequested()
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    NS_NewRunnableMethod(mTarget, &nsIUrlClassifierUpdateObserver::RekeyRequested);
-+  return NS_DispatchToMainThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::StreamFinished(nsresult aStatus,
-+                                                 PRUint32 aDelay)
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    new StreamFinishedRunnable(mTarget, aStatus, aDelay);
-+  return NS_DispatchToMainThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::StreamFinishedRunnable::Run()
-+{
-+  mTarget->StreamFinished(mStatus, mDelay);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::UpdateError(nsresult aError)
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    new UpdateErrorRunnable(mTarget, aError);
-+  return NS_DispatchToMainThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::UpdateErrorRunnable::Run()
-+{
-+  mTarget->UpdateError(mError);
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::UpdateSuccess(PRUint32 aRequestedTimeout)
-+{
-+  nsCOMPtr<nsIRunnable> r =
-+    new UpdateSuccessRunnable(mTarget, aRequestedTimeout);
-+  return NS_DispatchToMainThread(r);
-+}
-+
-+NS_IMETHODIMP
-+UrlClassifierUpdateObserverProxy::UpdateSuccessRunnable::Run()
-+{
-+  mTarget->UpdateSuccess(mRequestedTimeout);
-+  return NS_OK;
-+}
-diff --git a/toolkit/components/url-classifier/nsUrlClassifierProxies.h b/toolkit/components/url-classifier/nsUrlClassifierProxies.h
-new file mode 100644
---- /dev/null
-+++ b/toolkit/components/url-classifier/nsUrlClassifierProxies.h
-@@ -0,0 +1,315 @@
-+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-+/* ***** BEGIN LICENSE BLOCK *****
-+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-+ *
-+ * The contents of this file are subject to the Mozilla Public License Version
-+ * 1.1 (the "License"); you may not use this file except in compliance with
-+ * the License. You may obtain a copy of the License at
-+ * http://www.mozilla.org/MPL/
-+ *
-+ * Software distributed under the License is distributed on an "AS IS" basis,
-+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-+ * for the specific language governing rights and limitations under the
-+ * License.
-+ *
-+ * The Original Code is Mozilla Firefox.
-+ *
-+ * The Initial Developer of the Original Code is
-+ * the Mozilla Foundation <http://www.mozilla.org>.
-+ * Portions created by the Initial Developer are Copyright (C) 2011
-+ * the Initial Developer. All Rights Reserved.
-+ *
-+ * Contributor(s):
-+ *
-+ * Alternatively, the contents of this file may be used under the terms of
-+ * either the GNU General Public License Version 2 or later (the "GPL"), or
-+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-+ * in which case the provisions of the GPL or the LGPL are applicable instead
-+ * of those above. If you wish to allow use of your version of this file only
-+ * under the terms of either the GPL or the LGPL, and not to allow others to
-+ * use your version of this file under the terms of the MPL, indicate your
-+ * decision by deleting the provisions above and replace them with the notice
-+ * and other provisions required by the GPL or the LGPL. If you do not delete
-+ * 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 nsUrlClassifierProxies_h
-+#define nsUrlClassifierProxies_h
-+
-+#include "nsIUrlClassifierDBService.h"
-+#include "nsThreadUtils.h"
-+
-+/**
-+ * Thread proxy from the main thread to the worker thread.
-+ */
-+class UrlClassifierDBServiceWorkerProxy :
-+  public nsIUrlClassifierDBServiceWorker
-+{
-+public:
-+  UrlClassifierDBServiceWorkerProxy(nsIUrlClassifierDBServiceWorker* aTarget)
-+    : mTarget(aTarget)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIURLCLASSIFIERDBSERVICE
-+  NS_DECL_NSIURLCLASSIFIERDBSERVICEWORKER
-+
-+  class LookupRunnable : public nsRunnable
-+  {
-+  public:
-+    LookupRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
-+                   const nsACString& aSpec,
-+                   nsIUrlClassifierCallback* aCB)
-+      : mTarget(aTarget)
-+      , mSpec(aSpec)
-+      , mCB(aCB)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
-+    nsCString mSpec;
-+    nsCOMPtr<nsIUrlClassifierCallback> mCB;
-+  };
-+
-+  class GetTablesRunnable : public nsRunnable
-+  {
-+  public:
-+    GetTablesRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
-+                      nsIUrlClassifierCallback* aCB)
-+      : mTarget(aTarget)
-+      , mCB(aCB)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
-+    nsCOMPtr<nsIUrlClassifierCallback> mCB;
-+  };
-+
-+  class BeginUpdateRunnable : public nsRunnable
-+  {
-+  public:
-+    BeginUpdateRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
-+                        nsIUrlClassifierUpdateObserver* aUpdater,
-+                        const nsACString& aTables,
-+                        const nsACString& aClientKey)
-+      : mTarget(aTarget)
-+      , mUpdater(aUpdater)
-+      , mTables(aTables)
-+      , mClientKey(aClientKey)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
-+    nsCOMPtr<nsIUrlClassifierUpdateObserver> mUpdater;
-+    nsCString mTables, mClientKey;
-+  };
-+
-+  class BeginStreamRunnable : public nsRunnable
-+  {
-+  public:
-+    BeginStreamRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
-+                        const nsACString& aTable,
-+                        const nsACString& aServerMAC)
-+      : mTarget(aTarget)
-+      , mTable(aTable)
-+      , mServerMAC(aServerMAC)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
-+    nsCString mTable, mServerMAC;
-+  };
-+
-+  class UpdateStreamRunnable : public nsRunnable
-+  {
-+  public:
-+    UpdateStreamRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
-+                         const nsACString& aUpdateChunk)
-+      : mTarget(aTarget)
-+      , mUpdateChunk(aUpdateChunk)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
-+    nsCString mUpdateChunk;
-+  };
-+
-+  class CacheCompletionsRunnable : public nsRunnable
-+  {
-+  public:
-+    CacheCompletionsRunnable(nsIUrlClassifierDBServiceWorker* aTarget,
-+                             nsTArray<nsUrlClassifierLookupResult>* aEntries)
-+      : mTarget(aTarget)
-+      , mEntries(aEntries)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
-+    nsTArray<nsUrlClassifierLookupResult>* mEntries;
-+  };
-+
-+private:
-+  nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
-+};
-+
-+// The remaining classes here are all proxies to the main thread
-+
-+class UrlClassifierLookupCallbackProxy : public nsIUrlClassifierLookupCallback
-+{
-+public:
-+  UrlClassifierLookupCallbackProxy(nsIUrlClassifierLookupCallback* aTarget)
-+    : mTarget(aTarget)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIURLCLASSIFIERLOOKUPCALLBACK
-+
-+  class LookupCompleteRunnable : public nsRunnable
-+  {
-+  public:
-+    LookupCompleteRunnable(nsIUrlClassifierLookupCallback* aTarget,
-+                           nsTArray<nsUrlClassifierLookupResult>* aResults)
-+      : mTarget(aTarget)
-+      , mResults(aResults)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierLookupCallback> mTarget;
-+    nsTArray<nsUrlClassifierLookupResult>* mResults;
-+  };
-+
-+private:
-+  nsCOMPtr<nsIUrlClassifierLookupCallback> mTarget;
-+};
-+
-+class UrlClassifierCallbackProxy : public nsIUrlClassifierCallback
-+{
-+public:
-+  UrlClassifierCallbackProxy(nsIUrlClassifierCallback* aTarget)
-+    : mTarget(aTarget)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIURLCLASSIFIERCALLBACK
-+
-+  class HandleEventRunnable : public nsRunnable
-+  {
-+  public:
-+    HandleEventRunnable(nsIUrlClassifierCallback* aTarget,
-+                        const nsACString& aValue)
-+      : mTarget(aTarget)
-+      , mValue(aValue)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierCallback> mTarget;
-+    nsCString mValue;
-+  };
-+
-+private:
-+  nsCOMPtr<nsIUrlClassifierCallback> mTarget;
-+};
-+
-+class UrlClassifierUpdateObserverProxy : public nsIUrlClassifierUpdateObserver
-+{
-+public:
-+  UrlClassifierUpdateObserverProxy(nsIUrlClassifierUpdateObserver* aTarget)
-+    : mTarget(aTarget)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIURLCLASSIFIERUPDATEOBSERVER
-+
-+  class UpdateUrlRequestedRunnable : public nsRunnable
-+  {
-+  public:
-+    UpdateUrlRequestedRunnable(nsIUrlClassifierUpdateObserver* aTarget,
-+                               const nsACString& aURL,
-+                               const nsACString& aTable,
-+                               const nsACString& aServerMAC)
-+      : mTarget(aTarget)
-+      , mURL(aURL)
-+      , mTable(aTable)
-+      , mServerMAC(aServerMAC)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
-+    nsCString mURL, mTable, mServerMAC;
-+  };
-+
-+  class StreamFinishedRunnable : public nsRunnable
-+  {
-+  public:
-+    StreamFinishedRunnable(nsIUrlClassifierUpdateObserver* aTarget,
-+                           nsresult aStatus, PRUint32 aDelay)
-+      : mTarget(aTarget)
-+      , mStatus(aStatus)
-+      , mDelay(aDelay)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
-+    nsresult mStatus;
-+    PRUint32 mDelay;
-+  };
-+
-+  class UpdateErrorRunnable : public nsRunnable
-+  {
-+  public:
-+    UpdateErrorRunnable(nsIUrlClassifierUpdateObserver* aTarget,
-+                        nsresult aError)
-+      : mTarget(aTarget)
-+      , mError(aError)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
-+    nsresult mError;
-+  };
-+
-+  class UpdateSuccessRunnable : public nsRunnable
-+  {
-+  public:
-+    UpdateSuccessRunnable(nsIUrlClassifierUpdateObserver* aTarget,
-+                          PRUint32 aRequestedTimeout)
-+      : mTarget(aTarget)
-+      , mRequestedTimeout(aRequestedTimeout)
-+    { }
-+
-+    NS_DECL_NSIRUNNABLE
-+
-+  private:
-+    nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
-+    PRUint32 mRequestedTimeout;
-+  };
-+
-+private:
-+  nsCOMPtr<nsIUrlClassifierUpdateObserver> mTarget;
-+};
-+
-+#endif // nsUrlClassifierProxies_h
deleted file mode 100644
--- a/bug675221-partE-domstorage
+++ /dev/null
@@ -1,153 +0,0 @@
-# HG changeset patch
-# Parent 02d48a458371485fa4ca52efa57b1f23cc9e2f03
-Bug 675221 part E - fix up DOMStorage proxies (miscellaenous #includes from other places also included) r?mayhemer
-
-diff --git a/dom/src/storage/nsDOMStorage.cpp b/dom/src/storage/nsDOMStorage.cpp
---- a/dom/src/storage/nsDOMStorage.cpp
-+++ b/dom/src/storage/nsDOMStorage.cpp
-@@ -65,18 +65,18 @@ using mozilla::dom::StorageChild;
- #include "nsIPermission.h"
- #include "nsIPermissionManager.h"
- #include "nsCycleCollectionParticipant.h"
- #include "nsIOfflineCacheUpdate.h"
- #include "nsIJSContextStack.h"
- #include "nsIPrivateBrowsingService.h"
- #include "nsDOMString.h"
- #include "nsNetCID.h"
--#include "nsIProxyObjectManager.h"
- #include "mozilla/Preferences.h"
-+#include "nsThreadUtils.h"
- 
- using namespace mozilla;
- 
- static const PRUint32 ASK_BEFORE_ACCEPT = 1;
- static const PRUint32 ACCEPT_SESSION = 2;
- static const PRUint32 BEHAVIOR_REJECT = 2;
- 
- static const PRUint32 DEFAULT_QUOTA = 5 * 1024;
-@@ -1930,16 +1930,44 @@ nsPIDOMStorage::nsDOMStorageType
- nsDOMStorage2::StorageType()
- {
-   if (mStorage)
-     return mStorage->StorageType();
- 
-   return nsPIDOMStorage::Unknown;
- }
- 
-+namespace {
-+
-+class StorageNotifierRunnable : public nsRunnable
-+{
-+public:
-+  StorageNotifierRunnable(nsISupports* aSubject)
-+    : mSubject(aSubject)
-+  { }
-+
-+  NS_DECL_NSIRUNNABLE
-+
-+private:
-+  nsCOMPtr<nsISupports> mSubject;
-+};
-+
-+NS_IMETHODIMP
-+StorageNotifierRunnable::Run()
-+{
-+  nsCOMPtr<nsIObserverService> observerService =
-+    mozilla::services::GetObserverService();
-+  if (observerService) {
-+    observerService->NotifyObservers(mSubject, "dom-storage2-changed", nsnull);
-+  }
-+  return NS_OK;
-+}
-+
-+} // anonymous namespace
-+
- void
- nsDOMStorage2::BroadcastChangeNotification(const nsSubstring &aKey,
-                                           const nsSubstring &aOldValue,
-                                           const nsSubstring &aNewValue)
- {
-   nsresult rv;
-   nsCOMPtr<nsIDOMStorageEvent> event = new nsDOMStorageEvent();
-   rv = event->InitStorageEvent(NS_LITERAL_STRING("storage"),
-@@ -1949,36 +1977,18 @@ nsDOMStorage2::BroadcastChangeNotificati
-                                aOldValue,
-                                aNewValue,
-                                mDocumentURI,
-                                static_cast<nsIDOMStorage*>(this));
-   if (NS_FAILED(rv)) {
-     return;
-   }
- 
--  nsCOMPtr<nsIObserverService> observerService =
--    mozilla::services::GetObserverService();
--  if (!observerService) {
--    return;
--  }
--
--  nsCOMPtr<nsIObserverService> observerServiceProxy;
--  rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                            NS_GET_IID(nsIObserverService),
--                            observerService,
--                            NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
--                            getter_AddRefs(observerServiceProxy));
--  if (NS_FAILED(rv)) {
--    return;
--  }
--
--  // Fire off a notification that a storage object changed.
--  observerServiceProxy->NotifyObservers(event,
--                                        "dom-storage2-changed",
--                                        nsnull);
-+  nsRefPtr<StorageNotifierRunnable> r = new StorageNotifierRunnable(event);
-+  NS_DispatchToMainThread(r);
- }
- 
- NS_IMETHODIMP
- nsDOMStorage2::GetLength(PRUint32 *aLength)
- {
-   return mStorage->GetLength(aLength);
- }
- 
-diff --git a/modules/libpr0n/src/imgLoader.cpp b/modules/libpr0n/src/imgLoader.cpp
---- a/modules/libpr0n/src/imgLoader.cpp
-+++ b/modules/libpr0n/src/imgLoader.cpp
-@@ -57,17 +57,16 @@
- #include "nsNetUtil.h"
- #include "nsStreamUtils.h"
- #include "nsIHttpChannel.h"
- #include "nsICachingChannel.h"
- #include "nsIInterfaceRequestor.h"
- #include "nsIProgressEventSink.h"
- #include "nsIChannelEventSink.h"
- #include "nsIAsyncVerifyRedirectCallback.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIServiceManager.h"
- #include "nsIFileURL.h"
- #include "nsThreadUtils.h"
- #include "nsXPIDLString.h"
- #include "nsCRT.h"
- #include "nsIDocument.h"
- #include "nsPIDOMWindow.h"
- 
-diff --git a/modules/libpr0n/src/imgRequest.cpp b/modules/libpr0n/src/imgRequest.cpp
---- a/modules/libpr0n/src/imgRequest.cpp
-+++ b/modules/libpr0n/src/imgRequest.cpp
-@@ -62,17 +62,16 @@
- #include "nsICachingChannel.h"
- #include "nsILoadGroup.h"
- #include "nsIInputStream.h"
- #include "nsIMultiPartChannel.h"
- #include "nsIHttpChannel.h"
- 
- #include "nsIComponentManager.h"
- #include "nsIInterfaceRequestorUtils.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIServiceManager.h"
- #include "nsISupportsPrimitives.h"
- #include "nsIScriptSecurityManager.h"
- 
- #include "nsICacheVisitor.h"
- 
- #include "nsString.h"
- #include "nsXPIDLString.h"
deleted file mode 100644
--- a/bug675221-partF-psm
+++ /dev/null
@@ -1,3258 +0,0 @@
-# HG changeset patch
-# Parent 1a4655c0045e8f4c96e44b29cb9e96c990ae45f0
-Bug 675221 part F - Replace PSMs use of synchronous XPCOM proxies with compiled proxy classes which do synchronous proxying but don't spin a nested event loop, r?bsmith sr?bz
-
-diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
---- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
-+++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
-@@ -74,22 +74,22 @@
- #include "nsITransportSecurityInfo.h"
- #include "nsIIdentityInfo.h"
- #include "nsIURI.h"
- #include "nsISecurityEventSink.h"
- #include "nsIPrompt.h"
- #include "nsIFormSubmitObserver.h"
- #include "nsISecurityWarningDialogs.h"
- #include "nsISecurityInfoProvider.h"
--#include "nsIProxyObjectManager.h"
- #include "imgIRequest.h"
- #include "nsThreadUtils.h"
- #include "nsNetUtil.h"
- #include "nsNetCID.h"
- #include "nsCRT.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- using namespace mozilla;
- 
- #define SECURITY_STRING_BUNDLE_URL "chrome://pipnss/locale/security.properties"
- 
- #define IS_SECURE(state) ((state & 0xFFFF) == STATE_IS_SECURE)
- 
- #if defined(PR_LOGGING)
-@@ -1813,27 +1813,20 @@ nsresult nsSecureBrowserUIImpl::
- GetNSSDialogs(nsISecurityWarningDialogs **result)
- {
-   nsresult rv;
-   nsCOMPtr<nsISecurityWarningDialogs> my_result(do_GetService(NS_SECURITYWARNINGDIALOGS_CONTRACTID, &rv));
- 
-   if (NS_FAILED(rv)) 
-     return rv;
- 
--  nsCOMPtr<nsISupports> proxiedResult;
--  NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                       NS_GET_IID(nsISecurityWarningDialogs),
--                       my_result, NS_PROXY_SYNC,
--                       getter_AddRefs(proxiedResult));
--
--  if (!proxiedResult) {
--    return NS_ERROR_FAILURE;
--  }
--
--  return CallQueryInterface(proxiedResult, result);
-+  my_result = new SecurityWarningDialogsProxy(my_result);
-+  
-+  my_result.forget(result);
-+  return NS_OK;
- }
- 
- PRBool nsSecureBrowserUIImpl::
- ConfirmEnteringSecure()
- {
-   nsCOMPtr<nsISecurityWarningDialogs> dialogs;
- 
-   GetNSSDialogs(getter_AddRefs(dialogs));
-diff --git a/security/manager/ssl/src/Makefile.in b/security/manager/ssl/src/Makefile.in
---- a/security/manager/ssl/src/Makefile.in
-+++ b/security/manager/ssl/src/Makefile.in
-@@ -99,16 +99,21 @@ CPPSRCS = 				\
-   nsSmartCardEvent.cpp \
-   nsStreamCipher.cpp \
-   nsKeyModule.cpp \
-   nsIdentityChecking.cpp \
-   nsDataSignatureVerifier.cpp \
-   nsRandomGenerator.cpp \
-   NSSErrorsService.cpp \
-   nsNSSCertificateFakeTransport.cpp \
-+  nsSyncRunnableHelpers.cpp \
-+  $(NULL)
-+
-+EXPORTS = \
-+  nsSyncRunnableHelpers.h \
-   $(NULL)
- 
- ifdef MOZ_XUL
- CPPSRCS += nsCertTree.cpp
- endif
- 
- CSRCS += md4.c
- 
-diff --git a/security/manager/ssl/src/nsCRLManager.cpp b/security/manager/ssl/src/nsCRLManager.cpp
---- a/security/manager/ssl/src/nsCRLManager.cpp
-+++ b/security/manager/ssl/src/nsCRLManager.cpp
-@@ -46,17 +46,17 @@
- #include "nsIWindowWatcher.h"
- #include "nsCOMPtr.h"
- #include "nsIPrompt.h"
- #include "nsICertificateDialogs.h"
- #include "nsIMutableArray.h"
- #include "nsIPrefService.h"
- #include "nsIPrefBranch.h"
- #include "nsNSSShutDown.h"
--
-+#include "nsSyncRunnableHelpers.h"
- #include "nsNSSCertHeader.h"
- 
- #include "nspr.h"
- extern "C" {
- #include "pk11func.h"
- #include "certdb.h"
- #include "cert.h"
- #include "secerr.h"
-@@ -207,18 +207,23 @@ done:
-       // Not being able to display the success dialog should not
-       // be a fatal error, so don't return a failure code.
-       {
-         nsPSMUITracker tracker;
-         if (tracker.isUIForbidden()) {
-           rv = NS_ERROR_NOT_AVAILABLE;
-         }
-         else {
--          rv = ::getNSSDialogs(getter_AddRefs(certDialogs),
--            NS_GET_IID(nsICertificateDialogs), NS_CERTIFICATEDIALOGS_CONTRACTID);
-+          certDialogs = do_GetService(NS_CERTIFICATEDIALOGS_CONTRACTID);
-+          if (!certDialogs) {
-+            rv = NS_ERROR_FAILURE;
-+          }
-+          else {
-+            certDialogs = new CertificateDialogsProxy(certDialogs);
-+          }
-         }
-       }
-       if (NS_SUCCEEDED(rv)) {
-         nsCOMPtr<nsIInterfaceRequestor> cxt = new PipUIContext();
-         certDialogs->CrlImportStatusDialog(cxt, crlData);
-       }
-     }
-   } else {
-diff --git a/security/manager/ssl/src/nsCertOverrideService.cpp b/security/manager/ssl/src/nsCertOverrideService.cpp
---- a/security/manager/ssl/src/nsCertOverrideService.cpp
-+++ b/security/manager/ssl/src/nsCertOverrideService.cpp
-@@ -45,18 +45,18 @@
- #include "nsAppDirectoryServiceDefs.h"
- #include "nsStreamUtils.h"
- #include "nsNetUtil.h"
- #include "nsILineInputStream.h"
- #include "nsIObserver.h"
- #include "nsIObserverService.h"
- #include "nsISupportsPrimitives.h"
- #include "nsPromiseFlatString.h"
--#include "nsProxiedService.h"
- #include "nsStringBuffer.h"
-+#include "nsThreadUtils.h"
- #include "nsAutoPtr.h"
- #include "nspr.h"
- #include "pk11pub.h"
- #include "certdb.h"
- #include "sechash.h"
- #include "ssl.h" // For SSL_ClearSessionCache
- 
- #include "nsNSSCleaner.h"
-@@ -123,16 +123,39 @@ nsCertOverrideService::nsCertOverrideSer
-   : monitor("nsCertOverrideService.monitor")
- {
- }
- 
- nsCertOverrideService::~nsCertOverrideService()
- {
- }
- 
-+namespace {
-+
-+class ShutdownRegistrationRunnable : public nsRunnable
-+{
-+public:
-+  ShutdownRegistrationRunnable(nsIObserver* observer)
-+    : mObserver(observer)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-+    obs->AddObserver(mObserver, "profile-before-change", PR_TRUE);
-+    obs->AddObserver(mObserver, "profile-do-change", PR_TRUE);
-+    obs->AddObserver(mObserver, "shutdown-cleanse", PR_TRUE);
-+    return NS_OK;
-+  }
-+
-+private:
-+  nsCOMPtr<nsIObserver> mObserver;
-+};   
-+
-+} // anonymous namespace
-+
- nsresult
- nsCertOverrideService::Init()
- {
-   if (!mSettingsTable.Init())
-     return NS_ERROR_OUT_OF_MEMORY;
- 
-   mOidTagForStoringNewHashes = SEC_OID_SHA256;
- 
-@@ -150,26 +173,18 @@ nsCertOverrideService::Init()
-   // cache mSettingsFile
-   NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mSettingsFile));
-   if (mSettingsFile) {
-     mSettingsFile->AppendNative(NS_LITERAL_CSTRING(kCertOverrideFileName));
-   }
- 
-   Read();
- 
--  nsresult rv;
--  NS_WITH_ALWAYS_PROXIED_SERVICE(nsIObserverService, mObserverService,
--                                 "@mozilla.org/observer-service;1",
--                                 NS_PROXY_TO_MAIN_THREAD, &rv);
--
--  if (mObserverService) {
--    mObserverService->AddObserver(this, "profile-before-change", PR_TRUE);
--    mObserverService->AddObserver(this, "profile-do-change", PR_TRUE);
--    mObserverService->AddObserver(this, "shutdown-cleanse", PR_TRUE);
--  }
-+  nsCOMPtr<nsIRunnable> r = new ShutdownRegistrationRunnable(this);
-+  NS_DispatchToMainThread(r);
- 
-   return NS_OK;
- }
- 
- NS_IMETHODIMP
- nsCertOverrideService::Observe(nsISupports     *aSubject,
-                                const char      *aTopic,
-                                const PRUnichar *aData)
-diff --git a/security/manager/ssl/src/nsCertPicker.cpp b/security/manager/ssl/src/nsCertPicker.cpp
---- a/security/manager/ssl/src/nsCertPicker.cpp
-+++ b/security/manager/ssl/src/nsCertPicker.cpp
-@@ -42,16 +42,17 @@
- #include "nsIServiceManager.h"
- #include "nsNSSComponent.h"
- #include "nsNSSCertificate.h"
- #include "nsReadableUtils.h"
- #include "nsNSSCleaner.h"
- #include "nsICertPickDialogs.h"
- #include "nsNSSShutDown.h"
- #include "nsNSSCertHelper.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- NSSCleanupAutoPtrClass(CERTCertNicknames, CERT_FreeNicknames)
- NSSCleanupAutoPtrClass(CERTCertList, CERT_DestroyCertList)
- 
- #include "cert.h"
- 
- NS_IMPL_ISUPPORTS1(nsCertPicker, nsIUserCertPicker)
- 
-@@ -157,22 +158,24 @@ NS_IMETHODIMP nsCertPicker::PickByUsage(
- 
-       NS_RELEASE(tempCert);
- 
-       ++CertsToUse;
-     }
-   }
- 
-   if (CertsToUse) {
--    nsICertPickDialogs *dialogs = nsnull;
--    rv = getNSSDialogs((void**)&dialogs, 
--      NS_GET_IID(nsICertPickDialogs), 
--      NS_CERTPICKDIALOGS_CONTRACTID);
-+    nsCOMPtr<nsICertPickDialogs> dialogs =
-+      do_GetService(NS_CERTPICKDIALOGS_CONTRACTID);
-+    if (!dialogs) {
-+      rv = NS_ERROR_FAILURE;
-+    }
- 
-     if (NS_SUCCEEDED(rv)) {
-+      dialogs = new CertPickDialogsProxy(dialogs);
-       nsPSMUITracker tracker;
-       if (tracker.isUIForbidden()) {
-         rv = NS_ERROR_NOT_AVAILABLE;
-       }
-       else {
-         /* Throw up the cert picker dialog and get back the index of the selected cert */
-         rv = dialogs->PickCertificate(ctx,
-           (const PRUnichar**)certNicknameList, (const PRUnichar**)certDetailsList,
-diff --git a/security/manager/ssl/src/nsClientAuthRemember.cpp b/security/manager/ssl/src/nsClientAuthRemember.cpp
---- a/security/manager/ssl/src/nsClientAuthRemember.cpp
-+++ b/security/manager/ssl/src/nsClientAuthRemember.cpp
-@@ -39,19 +39,19 @@
- 
- #include "nsClientAuthRemember.h"
- 
- #include "nsIX509Cert.h"
- #include "nsCRT.h"
- #include "nsNetUtil.h"
- #include "nsIObserverService.h"
- #include "nsNetUtil.h"
-+#include "nsThreadUtils.h"
- #include "nsISupportsPrimitives.h"
- #include "nsPromiseFlatString.h"
--#include "nsProxiedService.h"
- #include "nsStringBuffer.h"
- #include "nspr.h"
- #include "pk11pub.h"
- #include "certdb.h"
- #include "sechash.h"
- #include "ssl.h" // For SSL_ClearSessionCache
- 
- #include "nsNSSCleaner.h"
-@@ -69,38 +69,47 @@ nsClientAuthRememberService::nsClientAut
- {
- }
- 
- nsClientAuthRememberService::~nsClientAuthRememberService()
- {
-   RemoveAllFromMemory();
- }
- 
-+namespace {
-+
-+class ProfileChangeRunnable : public nsRunnable
-+{
-+public:
-+  ProfileChangeRunnable(nsIObserver* observer)
-+    : mObserver(observer)
-+  { }
-+
-+  NS_METHOD Run() {
-+    nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-+    if (obs)
-+      obs->AddObserver(mObserver, "profile-before-change", PR_TRUE);
-+    return NS_OK;
-+  }
-+
-+private:
-+  nsCOMPtr<nsIObserver> mObserver;
-+};
-+
-+} // anonymous namespace
-+
- nsresult
- nsClientAuthRememberService::Init()
- {
-   if (!mSettingsTable.Init())
-     return NS_ERROR_OUT_OF_MEMORY;
- 
--  nsCOMPtr<nsIProxyObjectManager> proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID));
--  if (!proxyman)
--    return NS_ERROR_FAILURE;
--
--  nsCOMPtr<nsIObserverService> observerService(do_GetService("@mozilla.org/observer-service;1"));
--  nsCOMPtr<nsIObserverService> proxiedObserver;
--
--  NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                       NS_GET_IID(nsIObserverService),
--                       observerService,
--                       NS_PROXY_SYNC,
--                       getter_AddRefs(proxiedObserver));
--
--  if (proxiedObserver) {
--    proxiedObserver->AddObserver(this, "profile-before-change", PR_TRUE);
--  }
-+  nsCOMPtr<nsIRunnable> r = new ProfileChangeRunnable(this);
-+  // I really doubt this needs to be sync.
-+  NS_DispatchToMainThread(r, NS_DISPATCH_SYNC);
- 
-   return NS_OK;
- }
- 
- NS_IMETHODIMP
- nsClientAuthRememberService::Observe(nsISupports     *aSubject,
-                                const char      *aTopic,
-                                const PRUnichar *aData)
-diff --git a/security/manager/ssl/src/nsCrypto.cpp b/security/manager/ssl/src/nsCrypto.cpp
---- a/security/manager/ssl/src/nsCrypto.cpp
-+++ b/security/manager/ssl/src/nsCrypto.cpp
-@@ -68,17 +68,16 @@
- #include "nsIFilePicker.h"
- #include "nsJSPrincipals.h"
- #include "nsIPrincipal.h"
- #include "nsIScriptSecurityManager.h"
- #include "nsXPIDLString.h"
- #include "nsIGenKeypairInfoDlg.h"
- #include "nsIDOMCryptoDialogs.h"
- #include "nsIFormSigningDialog.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIJSContextStack.h"
- #include "jsapi.h"
- #include "jsdbgapi.h"
- #include <ctype.h>
- #include "nsReadableUtils.h"
- #include "pk11func.h"
- #include "keyhi.h"
- #include "cryptohi.h"
-@@ -91,16 +90,17 @@ extern "C" {
- }
- #include "cmmf.h"
- #include "nssb64.h"
- #include "base64.h"
- #include "cert.h"
- #include "certdb.h"
- #include "secmod.h"
- #include "nsISaveAsCharset.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- #include "ssl.h" // For SSL_ClearSessionCache
- 
- #include "nsNSSCleaner.h"
- NSSCleanupAutoPtrClass(SECKEYPrivateKey, SECKEY_DestroyPrivateKey)
- NSSCleanupAutoPtrClass(PK11SlotInfo, PK11_FreeSlot)
- NSSCleanupAutoPtrClass(CERTCertNicknames, CERT_FreeNicknames)
- NSSCleanupAutoPtrClass(PK11SymKey, PK11_FreeSymKey)
-@@ -682,17 +682,16 @@ nsFreeKeyGenParams(CK_MECHANISM_TYPE key
- //functions.
- static nsresult
- cryptojs_generateOneKeyPair(JSContext *cx, nsKeyPairInfo *keyPairInfo, 
-                             PRInt32 keySize, char *params, 
-                             nsIInterfaceRequestor *uiCxt,
-                             PK11SlotInfo *slot, PRBool willEscrow)
-                             
- {
--  nsIGeneratingKeypairInfoDialogs * dialogs;
-   nsKeygenThread *KeygenRunnable = 0;
-   nsCOMPtr<nsIKeygenThread> runnable;
- 
-   PRUint32 mechanism = cryptojs_convert_to_mechanism(keyPairInfo->keyGenType);
-   void *keyGenParams = nsConvertToActualKeyGenParams(mechanism, params, 
-                                                      (params) ? strlen(params):0, 
-                                                      keySize, keyPairInfo);
- 
-@@ -732,19 +731,24 @@ cryptojs_generateOneKeyPair(JSContext *c
-     NS_ASSERTION(intSlot,"Couldn't get the internal slot");
-     isPerm = PR_FALSE;
-     origSlot = slot;
-     slot = intSlot;
-   } else {
-     isPerm = PR_TRUE;
-   }
- 
--  rv = getNSSDialogs((void**)&dialogs,
--                     NS_GET_IID(nsIGeneratingKeypairInfoDialogs),
--                     NS_GENERATINGKEYPAIRINFODIALOGS_CONTRACTID);
-+  nsCOMPtr<nsIGeneratingKeypairInfoDialogs> dialogs =
-+    do_GetService(NS_GENERATINGKEYPAIRINFODIALOGS_CONTRACTID);
-+  if (!dialogs) {
-+    rv = NS_ERROR_FAILURE;
-+  }
-+  else {
-+    dialogs = new GeneratingKeypairInfoDialogsProxy(dialogs);
-+  }
- 
-   if (NS_SUCCEEDED(rv)) {
-     KeygenRunnable = new nsKeygenThread();
-     if (KeygenRunnable) {
-       NS_ADDREF(KeygenRunnable);
-     }
-   }
- 
-@@ -767,17 +771,16 @@ cryptojs_generateOneKeyPair(JSContext *c
-         else {
-           rv = dialogs->DisplayGeneratingKeypairInfo(uiCxt, runnable);
-           // We call join on the thread, 
-           // so we can be sure that no simultaneous access to the passed parameters will happen.
-           KeygenRunnable->Join();
-         }
-       }
- 
--      NS_RELEASE(dialogs);
-       if (NS_SUCCEEDED(rv)) {
-         rv = KeygenRunnable->GetParams(&keyPairInfo->privKey, &keyPairInfo->pubKey);
-       }
-     }
-   }
- 
-   nsFreeKeyGenParams(mechanism, keyGenParams);
- 
-@@ -1918,22 +1921,22 @@ nsCrypto::GenerateCRMFRequest(nsIDOMCRMF
-       return NS_ERROR_FAILURE;
- 
-     escrowCert = nsNSSCertificate::Create(cert);
-     CERT_DestroyCertificate(cert);
-     nssCert = escrowCert;
-     if (!nssCert)
-       return NS_ERROR_OUT_OF_MEMORY;
- 
--    nsCOMPtr<nsIDOMCryptoDialogs> dialogs;
--    nsresult rv = getNSSDialogs(getter_AddRefs(dialogs),
--                                NS_GET_IID(nsIDOMCryptoDialogs),
--                                NS_DOMCRYPTODIALOGS_CONTRACTID);
--    if (NS_FAILED(rv))
--      return rv;
-+    nsCOMPtr<nsIDOMCryptoDialogs> dialogs =
-+      do_GetService(NS_DOMCRYPTODIALOGS_CONTRACTID);
-+    if (!dialogs)
-+      return NS_ERROR_FAILURE;
-+
-+    dialogs = new DOMCryptoDialogsProxy(dialogs);
- 
-     PRBool okay=PR_FALSE;
-     {
-       nsPSMUITracker tracker;
-       if (tracker.isUIForbidden()) {
-         okay = PR_FALSE;
-       }
-       else {
-@@ -2605,26 +2608,18 @@ nsCrypto::SignText(const nsAString& aStr
-   nsCOMPtr<nsIFormSigningDialog> fsd =
-     do_CreateInstance(NS_FORMSIGNINGDIALOG_CONTRACTID);
-   if (!fsd) {
-     aResult.Append(internalError);
- 
-     return NS_OK;
-   }
- 
--  nsCOMPtr<nsIFormSigningDialog> proxied_fsd;
--  nsresult rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                                     NS_GET_IID(nsIFormSigningDialog), 
--                                     fsd, NS_PROXY_SYNC,
--                                     getter_AddRefs(proxied_fsd));
--  if (NS_FAILED(rv)) {
--    aResult.Append(internalError);
--
--    return NS_OK;
--  }
-+  nsCOMPtr<nsIFormSigningDialog> proxied_fsd =
-+    new FormSigningDialogProxy(fsd);
- 
-   nsCOMPtr<nsIDocument> document;
-   GetDocumentFromContext(cx, getter_AddRefs(document));
-   if (!document) {
-     aResult.Append(internalError);
- 
-     return NS_OK;
-   }
-@@ -2633,17 +2628,17 @@ nsCrypto::SignText(const nsAString& aStr
-   nsIURI* uri = document->GetDocumentURI();
-   if (!uri) {
-     aResult.Append(internalError);
- 
-     return NS_OK;
-   }
- 
-   nsCString host;
--  rv = uri->GetHost(host);
-+  nsresult rv = uri->GetHost(host);
-   if (NS_FAILED(rv)) {
-     aResult.Append(internalError);
- 
-     return NS_OK;
-   }
- 
-   PRInt32 numberOfCerts = 0;
-   CERTCertListNode* node;
-diff --git a/security/manager/ssl/src/nsKeygenHandler.cpp b/security/manager/ssl/src/nsKeygenHandler.cpp
---- a/security/manager/ssl/src/nsKeygenHandler.cpp
-+++ b/security/manager/ssl/src/nsKeygenHandler.cpp
-@@ -46,29 +46,29 @@ extern "C" {
- #include "keyhi.h"
- #include "secder.h"
- #include "cryptohi.h"
- #include "base64.h"
- #include "secasn1.h"
- extern "C" {
- #include "pk11pqg.h"
- }
--#include "nsProxiedService.h"
- #include "nsKeygenHandler.h"
- #include "nsVoidArray.h"
- #include "nsIServiceManager.h"
- #include "nsIDOMHTMLSelectElement.h"
- #include "nsIContent.h"
- #include "nsKeygenThread.h"
- #include "nsReadableUtils.h"
- #include "nsUnicharUtils.h"
- #include "nsCRT.h"
- #include "nsITokenDialogs.h"
- #include "nsIGenKeypairInfoDlg.h"
- #include "nsNSSShutDown.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- //These defines are taken from the PKCS#11 spec
- #define CKM_RSA_PKCS_KEY_PAIR_GEN     0x00000000
- #define CKM_DH_PKCS_KEY_PAIR_GEN      0x00000020
- #define CKM_DSA_KEY_PAIR_GEN          0x00000010
- 
- DERTemplate SECAlgorithmIDTemplate[] = {
-     { DER_SEQUENCE,
-@@ -392,17 +392,16 @@ PRUint32 MapGenMechToAlgoMech(PRUint32 m
- nsresult
- GetSlotWithMechanism(PRUint32 aMechanism, 
-                      nsIInterfaceRequestor *m_ctx,
-                      PK11SlotInfo** aSlot)
- {
-     nsNSSShutDownPreventionLock locker;
-     PK11SlotList * slotList = nsnull;
-     PRUnichar** tokenNameList = nsnull;
--    nsITokenDialogs * dialogs;
-     PRUnichar *unicodeTokenChosen;
-     PK11SlotListElement *slotElement, *tmpSlot;
-     PRUint32 numSlots = 0, i = 0;
-     PRBool canceled;
-     nsresult rv = NS_OK;
- 
-     *aSlot = nsnull;
- 
-@@ -444,21 +443,24 @@ GetSlotWithMechanism(PRUint32 aMechanism
-                 numSlots = i;
-                 PK11_FreeSlotListElement(slotList, slotElement);
-                 rv = NS_ERROR_OUT_OF_MEMORY;
-                 goto loser;
-             }
-         }
- 
- 		/* Throw up the token list dialog and get back the token */
--		rv = getNSSDialogs((void**)&dialogs,
--			               NS_GET_IID(nsITokenDialogs),
--                     NS_TOKENDIALOGS_CONTRACTID);
-+    nsCOMPtr<nsITokenDialogs> dialogs =
-+      do_GetService(NS_TOKENDIALOGS_CONTRACTID);
-+    if (!dialogs) {
-+      rv = NS_ERROR_FAILURE;
-+      goto loser;
-+    }
- 
--		if (NS_FAILED(rv)) goto loser;
-+    dialogs = new TokenDialogsProxy(dialogs);
- 
-     {
-       nsPSMUITracker tracker;
-       if (!tokenNameList || !*tokenNameList) {
-           rv = NS_ERROR_OUT_OF_MEMORY;
-       }
-       else if (tracker.isUIForbidden()) {
-         rv = NS_ERROR_NOT_AVAILABLE;
-@@ -523,18 +525,18 @@ nsKeygenFormProcessor::GetPublicKey(nsAS
-     CERTSubjectPublicKeyInfo *spkInfo = nsnull;
-     PRArenaPool *arena = nsnull;
-     SECStatus sec_rv = SECFailure;
-     SECItem spkiItem;
-     SECItem pkacItem;
-     SECItem signedItem;
-     CERTPublicKeyAndChallenge pkac;
-     pkac.challenge.data = nsnull;
--    nsIGeneratingKeypairInfoDialogs * dialogs;
-     nsKeygenThread *KeygenRunnable = 0;
-+    nsCOMPtr<nsIGeneratingKeypairInfoDialogs> dialogs;
-     nsCOMPtr<nsIKeygenThread> runnable;
- 
-     // Get the key size //
-     for (size_t i = 0; i < number_of_key_size_choices; ++i) {
-         if (aValue.Equals(mSECKeySizeChoiceList[i].name)) {
-             keysize = mSECKeySizeChoiceList[i].size;
-             break;
-         }
-@@ -660,26 +662,24 @@ nsKeygenFormProcessor::GetPublicKey(nsAS
-     if (NS_FAILED(rv))
-         goto loser;
- 
-     sec_rv = PK11_Authenticate(slot, PR_TRUE, m_ctx);
-     if (sec_rv != SECSuccess) {
-         goto loser;
-     }
- 
--    rv = getNSSDialogs((void**)&dialogs,
--                       NS_GET_IID(nsIGeneratingKeypairInfoDialogs),
--                       NS_GENERATINGKEYPAIRINFODIALOGS_CONTRACTID);
--
--    if (NS_SUCCEEDED(rv)) {
-+    dialogs = do_GetService(NS_GENERATINGKEYPAIRINFODIALOGS_CONTRACTID);
-+    if (dialogs) {
-+        dialogs = new GeneratingKeypairInfoDialogsProxy(dialogs);
-         KeygenRunnable = new nsKeygenThread();
-         NS_IF_ADDREF(KeygenRunnable);
-     }
- 
--    if (NS_FAILED(rv) || !KeygenRunnable) {
-+    if (!dialogs || !KeygenRunnable) {
-         rv = NS_OK;
-         privateKey = PK11_GenerateKeyPair(slot, keyGenMechanism, params,
-                                           &publicKey, PR_TRUE, PR_TRUE, m_ctx);
-     } else {
-         KeygenRunnable->SetParams( slot, keyGenMechanism, params, PR_TRUE, PR_TRUE, m_ctx );
- 
-         runnable = do_QueryInterface(KeygenRunnable);
-         
-@@ -692,17 +692,16 @@ nsKeygenFormProcessor::GetPublicKey(nsAS
-               else {
-                 rv = dialogs->DisplayGeneratingKeypairInfo(m_ctx, runnable);
-                 // We call join on the thread, 
-                 // so we can be sure that no simultaneous access to the passed parameters will happen.
-                 KeygenRunnable->Join();
-               }
-             }
- 
--            NS_RELEASE(dialogs);
-             if (NS_SUCCEEDED(rv)) {
-                 rv = KeygenRunnable->GetParams(&privateKey, &publicKey);
-             }
-         }
-     }
-     
-     if (NS_FAILED(rv) || !privateKey) {
-         goto loser;
-diff --git a/security/manager/ssl/src/nsKeygenThread.cpp b/security/manager/ssl/src/nsKeygenThread.cpp
---- a/security/manager/ssl/src/nsKeygenThread.cpp
-+++ b/security/manager/ssl/src/nsKeygenThread.cpp
-@@ -33,21 +33,21 @@
-  * and other provisions required by the GPL or the LGPL. If you do not delete
-  * 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 ***** */
- 
- #include "pk11func.h"
- #include "nsCOMPtr.h"
--#include "nsProxiedService.h"
- #include "nsThreadUtils.h"
- #include "nsKeygenThread.h"
- #include "nsIObserver.h"
- #include "nsNSSShutDown.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- using namespace mozilla;
- 
- NS_IMPL_THREADSAFE_ISUPPORTS1(nsKeygenThread, nsIKeygenThread)
- 
- 
- nsKeygenThread::nsKeygenThread()
- :mutex("nsKeygenThread.mutex"),
-@@ -136,22 +136,17 @@ static void PR_CALLBACK nsKeygenThreadRu
-   self->Run();
- }
- 
- nsresult nsKeygenThread::StartKeyGeneration(nsIObserver* aObserver)
- {
-   if (!aObserver)
-     return NS_OK;
- 
--  nsCOMPtr<nsIObserver> obs;
--  NS_GetProxyForObject( NS_PROXY_TO_MAIN_THREAD,
--                        NS_GET_IID(nsIObserver),
--                        aObserver,
--                        NS_PROXY_SYNC | NS_PROXY_ALWAYS,
--                        getter_AddRefs(obs));
-+  nsCOMPtr<nsIObserver> obs = new ObserverProxy(aObserver);
- 
-   MutexAutoLock lock(mutex);
- 
-     if (iAmRunning || keygenReady) {
-       return NS_OK;
-     }
- 
-     observer.swap(obs);
-diff --git a/security/manager/ssl/src/nsNSSCallbacks.cpp b/security/manager/ssl/src/nsNSSCallbacks.cpp
---- a/security/manager/ssl/src/nsNSSCallbacks.cpp
-+++ b/security/manager/ssl/src/nsNSSCallbacks.cpp
-@@ -49,17 +49,17 @@
- #include "nsIWebProgressListener.h"
- #include "nsIStringBundle.h"
- #include "nsXPIDLString.h"
- #include "nsCOMPtr.h"
- #include "nsAutoPtr.h"
- #include "nsIServiceManager.h"
- #include "nsReadableUtils.h"
- #include "nsIPrompt.h"
--#include "nsProxiedService.h"
-+#include "nsSyncRunnableHelpers.h"
- #include "nsIInterfaceRequestor.h"
- #include "nsIInterfaceRequestorUtils.h"
- #include "nsProtectedAuthThread.h"
- #include "nsITokenDialogs.h"
- #include "nsCRT.h"
- #include "nsNSSShutDown.h"
- #include "nsIUploadChannel.h"
- #include "nsSSLThread.h"
-@@ -670,33 +670,31 @@ void nsHTTPListener::send_done_signal()
- }
- 
- static char*
- ShowProtectedAuthPrompt(PK11SlotInfo* slot, nsIInterfaceRequestor *ir)
- {
-   char* protAuthRetVal = nsnull;
- 
-   // Get protected auth dialogs
--  nsITokenDialogs* dialogs = 0;
--  nsresult nsrv = getNSSDialogs((void**)&dialogs, 
--                                NS_GET_IID(nsITokenDialogs), 
--                                NS_TOKENDIALOGS_CONTRACTID);
--  if (NS_SUCCEEDED(nsrv))
-+  nsCOMPtr<nsITokenDialogs> dialogs = do_GetService(NS_TOKENDIALOGS_CONTRACTID);
-+  if (dialogs)
-   {
-+    dialogs = new TokenDialogsProxy(dialogs);
-     nsProtectedAuthThread* protectedAuthRunnable = new nsProtectedAuthThread();
-     if (protectedAuthRunnable)
-     {
-       NS_ADDREF(protectedAuthRunnable);
- 
-       protectedAuthRunnable->SetParams(slot);
-       
-       nsCOMPtr<nsIProtectedAuthThread> runnable = do_QueryInterface(protectedAuthRunnable);
-       if (runnable)
-       {
--        nsrv = dialogs->DisplayProtectedAuth(ir, runnable);
-+        nsresult nsrv = dialogs->DisplayProtectedAuth(ir, runnable);
-               
-         // We call join on the thread,
-         // so we can be sure that no simultaneous access will happen.
-         protectedAuthRunnable->Join();
-               
-         if (NS_SUCCEEDED(nsrv))
-         {
-           SECStatus rv = protectedAuthRunnable->GetResult();
-@@ -713,18 +711,16 @@ ShowProtectedAuthPrompt(PK11SlotInfo* sl
-                   break;
-               
-           }
-         }
-       }
- 
-       NS_RELEASE(protectedAuthRunnable);
-     }
--
--    NS_RELEASE(dialogs);
-   }
- 
-   return protAuthRetVal;
- }
-   
- char* PR_CALLBACK
- PK11PasswordPrompt(PK11SlotInfo* slot, PRBool retry, void* arg) {
-   nsNSSShutDownPreventionLock locker;
-@@ -746,48 +742,34 @@ PK11PasswordPrompt(PK11SlotInfo* slot, P
-     if (!wwatch)
-       return nsnull;
- 
-     nsCOMPtr<nsIPrompt> prompter;
-     wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
-     if (!prompter)
-       return nsnull;
- 
--    NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                         NS_GET_IID(nsIPrompt),
--                         prompter, NS_PROXY_SYNC,
--                         getter_AddRefs(proxyPrompt));
--    if (!proxyPrompt)
--      return nsnull;
-+    proxyPrompt = new PromptProxy(prompter);
-   }
-   else
-   {
-     // The interface requestor object may not be safe, so
-     // proxy the call to get the nsIPrompt.
-   
--    nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
--    NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                         NS_GET_IID(nsIInterfaceRequestor),
--                         ir,
--                         NS_PROXY_SYNC,
--                         getter_AddRefs(proxiedCallbacks));
--  
-+    nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks =
-+      new InterfaceRequestorProxy(ir);
-+
-     // Get the desired interface
-     nsCOMPtr<nsIPrompt> prompt(do_GetInterface(proxiedCallbacks));
-     if (!prompt) {
-       NS_ASSERTION(PR_FALSE, "callbacks does not implement nsIPrompt");
-       return nsnull;
-     }
-   
--    // Finally, get a proxy for the nsIPrompt
--    NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                         NS_GET_IID(nsIPrompt),
--                         prompt,
--                         NS_PROXY_SYNC,
--                         getter_AddRefs(proxyPrompt));
-+    proxyPrompt = new PromptProxy(prompt);
-   }
- 
-   if (PK11_ProtectedAuthenticationPath(slot))
-     return ShowProtectedAuthPrompt(slot, ir);
- 
-   nsAutoString promptString;
-   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
- 
-diff --git a/security/manager/ssl/src/nsNSSCertificate.cpp b/security/manager/ssl/src/nsNSSCertificate.cpp
---- a/security/manager/ssl/src/nsNSSCertificate.cpp
-+++ b/security/manager/ssl/src/nsNSSCertificate.cpp
-@@ -54,28 +54,28 @@
- #include "nsIX509Cert.h"
- #include "nsIX509Cert3.h"
- #include "nsISMimeCert.h"
- #include "nsNSSASN1Object.h"
- #include "nsString.h"
- #include "nsXPIDLString.h"
- #include "nsReadableUtils.h"
- #include "nsIURI.h"
--#include "nsIProxyObjectManager.h"
- #include "nsCRT.h"
- #include "nsUsageArrayHelper.h"
- #include "nsICertificateDialogs.h"
- #include "nsNSSCertHelper.h"
- #include "nsISupportsPrimitives.h"
- #include "nsUnicharUtils.h"
- #include "nsThreadUtils.h"
- #include "nsCertVerificationThread.h"
- #include "nsIObjectOutputStream.h"
- #include "nsIObjectInputStream.h"
- #include "nsIProgrammingLanguage.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- #include "nsXULAppAPI.h"
- 
- #include "nspr.h"
- extern "C" {
- #include "pk11func.h"
- #include "certdb.h"
- #include "cert.h"
-@@ -377,27 +377,19 @@ nsNSSCertificate::FormatUIStrings(const 
-   nsresult rv = NS_OK;
- 
-   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
- 
-   if (NS_FAILED(rv) || !nssComponent) {
-     return NS_ERROR_FAILURE;
-   }
-   
--  nsCOMPtr<nsIX509Cert> x509Proxy;
--  NS_GetProxyForObject( NS_PROXY_TO_MAIN_THREAD,
--                        NS_GET_IID(nsIX509Cert),
--                        static_cast<nsIX509Cert*>(this),
--                        NS_PROXY_SYNC | NS_PROXY_ALWAYS,
--                        getter_AddRefs(x509Proxy));
-+  nsCOMPtr<nsIX509Cert> x509Proxy = new X509CertProxy(this);
- 
--  if (!x509Proxy) {
--    rv = NS_ERROR_OUT_OF_MEMORY;
--  }
--  else {
-+  {
-     rv = NS_OK;
- 
-     nsAutoString info;
-     nsAutoString temp1;
- 
-     nickWithSerial.Append(nickname);
- 
-     if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoIssuedFor", info))) {
-@@ -422,24 +414,19 @@ nsNSSCertificate::FormatUIStrings(const 
-       nickWithSerial.Append(PRUnichar(']'));
- 
-       details.Append(PRUnichar('\n'));
-     }
- 
- 
-     {
-       nsCOMPtr<nsIX509CertValidity> validity;
--      nsCOMPtr<nsIX509CertValidity> originalValidity;
--      rv = x509Proxy->GetValidity(getter_AddRefs(originalValidity));
--      if (NS_SUCCEEDED(rv) && originalValidity) {
--        NS_GetProxyForObject( NS_PROXY_TO_MAIN_THREAD,
--                              NS_GET_IID(nsIX509CertValidity),
--                              originalValidity,
--                              NS_PROXY_SYNC | NS_PROXY_ALWAYS,
--                              getter_AddRefs(validity));
-+      rv = x509Proxy->GetValidity(getter_AddRefs(validity));
-+      if (NS_SUCCEEDED(rv) && validity) {
-+        validity = new X509CertValidityProxy(validity);
-       }
- 
-       if (validity) {
-         details.AppendLiteral("  ");
-         if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoValid", info))) {
-           details.Append(info);
-         }
- 
-diff --git a/security/manager/ssl/src/nsNSSCertificateDB.cpp b/security/manager/ssl/src/nsNSSCertificateDB.cpp
---- a/security/manager/ssl/src/nsNSSCertificateDB.cpp
-+++ b/security/manager/ssl/src/nsNSSCertificateDB.cpp
-@@ -53,18 +53,17 @@
- #include "nsReadableUtils.h"
- #include "nsIMutableArray.h"
- #include "nsArrayUtils.h"
- #include "nsNSSShutDown.h"
- #include "nsIPrefService.h"
- #include "nsIPrefBranch.h"
- #include "nsComponentManagerUtils.h"
- #include "nsIPrompt.h"
--#include "nsIProxyObjectManager.h"
--#include "nsProxiedService.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- #include "nspr.h"
- extern "C" {
- #include "pk11func.h"
- #include "certdb.h"
- #include "cert.h"
- #include "secerr.h"
- #include "nssb64.h"
-@@ -344,26 +343,25 @@ nsNSSCertificateDB::handleCACertDownload
-       selCertIndex = 0;
-       certToShow = cert0;
-     }
-   }
- 
-   if (!certToShow)
-     return NS_ERROR_FAILURE;
- 
--  nsCOMPtr<nsICertificateDialogs> dialogs;
--  nsresult rv = ::getNSSDialogs(getter_AddRefs(dialogs), 
--                                NS_GET_IID(nsICertificateDialogs),
--                                NS_CERTIFICATEDIALOGS_CONTRACTID);
--                       
--  if (NS_FAILED(rv))
--    return rv;
-+  nsCOMPtr<nsICertificateDialogs> dialogs =
-+    do_GetService(NS_CERTIFICATEDIALOGS_CONTRACTID);
-+  if (!dialogs)
-+    return NS_ERROR_FAILURE;
-+
-+  dialogs = new CertificateDialogsProxy(dialogs);
-  
-   SECItem der;
--  rv=certToShow->GetRawDER(&der.len, (PRUint8 **)&der.data);
-+  nsresult rv = certToShow->GetRawDER(&der.len, (PRUint8 **)&der.data);
- 
-   if (NS_FAILED(rv))
-     return rv;
- 
-   PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Creating temp cert\n"));
-   CERTCertificate *tmpCert;
-   CERTCertDBHandle *certdb = CERT_GetDefaultCertDB();
-   tmpCert = CERT_FindCertByDERCert(certdb, &der);
-@@ -895,35 +893,27 @@ void nsNSSCertificateDB::DisplayCertific
-     nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
-     if (NS_SUCCEEDED(rv)) {
-       nsAutoString tmpMessage;
-       nssComponent->GetPIPNSSBundleString(stringID, tmpMessage);
- 
-       // The interface requestor object may not be safe, so proxy the call to get
-       // the nsIPrompt.
- 
--      nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
--      NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                           NS_GET_IID(nsIInterfaceRequestor),
--                           my_cxt,
--                           NS_PROXY_SYNC,
--                           getter_AddRefs(proxiedCallbacks));
-+      nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks =
-+        new InterfaceRequestorProxy(my_cxt);
-     
-       nsCOMPtr<nsIPrompt> prompt (do_GetInterface(proxiedCallbacks));
-       if (!prompt)
-         return;
-     
-       // Finally, get a proxy for the nsIPrompt
-     
--      nsCOMPtr<nsIPrompt> proxyPrompt;
--      NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                           NS_GET_IID(nsIPrompt),
--                           prompt,
--                           NS_PROXY_SYNC,
--                           getter_AddRefs(proxyPrompt));
-+      nsCOMPtr<nsIPrompt> proxyPrompt =
-+        new PromptProxy(prompt);
-     
-       proxyPrompt->Alert(nsnull, tmpMessage.get());
-     }
-   }
- }
- 
- 
- NS_IMETHODIMP 
-diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp
---- a/security/manager/ssl/src/nsNSSComponent.cpp
-+++ b/security/manager/ssl/src/nsNSSComponent.cpp
-@@ -54,17 +54,16 @@
- #include "nsAppDirectoryServiceDefs.h"
- #include "nsDirectoryService.h"
- #include "nsIStreamListener.h"
- #include "nsIStringBundle.h"
- #include "nsIDirectoryService.h"
- #include "nsIDOMNode.h"
- #include "nsCURILoader.h"
- #include "nsDirectoryServiceDefs.h"
--#include "nsIProxyObjectManager.h"
- #include "nsIX509Cert.h"
- #include "nsIX509CertDB.h"
- #include "nsIProfileChangeStatus.h"
- #include "nsNSSCertificate.h"
- #include "nsNSSHelper.h"
- #include "nsSmartCardMonitor.h"
- #include "prlog.h"
- #include "nsIPrefService.h"
-@@ -81,30 +80,30 @@
- #include "nsThreadUtils.h"
- #include "nsAutoPtr.h"
- #include "nsCRT.h"
- #include "nsCRLInfo.h"
- #include "nsCertOverrideService.h"
- 
- #include "nsIWindowWatcher.h"
- #include "nsIPrompt.h"
--#include "nsProxiedService.h"
- #include "nsIPrincipal.h"
- #include "nsReadableUtils.h"
- #include "nsIDateTimeFormat.h"
- #include "prtypes.h"
- #include "nsIEntropyCollector.h"
- #include "nsIBufEntropyCollector.h"
- #include "nsIServiceManager.h"
- #include "nsILocalFile.h"
- #include "nsITokenPasswordDialogs.h"
- #include "nsICRLManager.h"
- #include "nsNSSShutDown.h"
- #include "nsSmartCardEvent.h"
- #include "nsIKeyModule.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- #include "nss.h"
- #include "pk11func.h"
- #include "ssl.h"
- #include "sslproto.h"
- #include "secmod.h"
- #include "sechash.h"
- #include "secmime.h"
-@@ -2443,27 +2442,18 @@ void nsNSSComponent::ShowAlert(AlertIden
-   }
-   else {
-     nsCOMPtr<nsIPrompt> prompter;
-     wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
-     if (!prompter) {
-       PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can't get window prompter\n"));
-     }
-     else {
--      nsCOMPtr<nsIPrompt> proxyPrompt;
--      NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                           NS_GET_IID(nsIPrompt),
--                           prompter, NS_PROXY_SYNC,
--                           getter_AddRefs(proxyPrompt));
--      if (!proxyPrompt) {
--        PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can't get proxy for nsIPrompt\n"));
--      }
--      else {
--        proxyPrompt->Alert(nsnull, message.get());
--      }
-+      nsCOMPtr<nsIPrompt> proxyPrompt = new PromptProxy(prompter);
-+      proxyPrompt->Alert(nsnull, message.get());
-     }
-   }
- }
- 
- nsresult nsNSSComponent::LogoutAuthenticatedPK11()
- {
-   nsCOMPtr<nsICertOverrideService> icos =
-     do_GetService("@mozilla.org/security/certoverride;1");
-@@ -3089,83 +3079,58 @@ NS_IMETHODIMP PipUIContext::GetInterface
-   nsresult rv = NS_OK;
- 
-   if (uuid.Equals(NS_GET_IID(nsIPrompt))) {
-     nsCOMPtr<nsIPrompt> prompter;
-     nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
-     if (wwatch) {
-       wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
-       if (prompter) {
--        nsCOMPtr<nsIPrompt> proxyPrompt;
--        NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                             NS_GET_IID(nsIPrompt),
--                             prompter, NS_PROXY_SYNC,
--                             getter_AddRefs(proxyPrompt));
--        if (!proxyPrompt) return NS_ERROR_FAILURE;
--        *result = proxyPrompt;
--        NS_ADDREF((nsIPrompt*)*result);
-+        nsCOMPtr<nsIPrompt> proxyPrompt = new PromptProxy(prompter);
-+        proxyPrompt.forget(reinterpret_cast<nsIPrompt**>(result));
-       }
-     }
-   } else {
-     rv = NS_ERROR_NO_INTERFACE;
-   }
- 
-   return rv;
- }
- 
--nsresult 
--getNSSDialogs(void **_result, REFNSIID aIID, const char *contract)
--{
--  nsresult rv;
--
--  nsCOMPtr<nsISupports> svc = do_GetService(contract, &rv);
--  if (NS_FAILED(rv)) 
--    return rv;
--
--  rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                            aIID, svc, NS_PROXY_SYNC,
--                            _result);
--  return rv;
--}
--
- nsresult
- setPassword(PK11SlotInfo *slot, nsIInterfaceRequestor *ctx)
- {
-   nsNSSShutDownPreventionLock locker;
--  nsresult rv = NS_OK;
-   
-   if (PK11_NeedUserInit(slot)) {
--    nsITokenPasswordDialogs *dialogs;
-+    nsCOMPtr<nsITokenPasswordDialogs> dialogs =
-+      do_GetService(NS_TOKENPASSWORDSDIALOG_CONTRACTID);
-+
-+    if (!dialogs)
-+      return NS_ERROR_FAILURE;
-+
-+    dialogs = new TokenPasswordDialogsProxy(dialogs);
-+
-     PRBool canceled;
-     NS_ConvertUTF8toUTF16 tokenName(PK11_GetTokenName(slot));
- 
--    rv = getNSSDialogs((void**)&dialogs,
--                       NS_GET_IID(nsITokenPasswordDialogs),
--                       NS_TOKENPASSWORDSDIALOG_CONTRACTID);
--
--    if (NS_FAILED(rv)) goto loser;
--
--    {
--      nsPSMUITracker tracker;
--      if (tracker.isUIForbidden()) {
--        rv = NS_ERROR_NOT_AVAILABLE;
--      }
--      else {
--        rv = dialogs->SetPassword(ctx,
--                                  tokenName.get(),
--                                  &canceled);
--      }
--    }
--    NS_RELEASE(dialogs);
--    if (NS_FAILED(rv)) goto loser;
--
--    if (canceled) { rv = NS_ERROR_NOT_AVAILABLE; goto loser; }
-+    nsPSMUITracker tracker;
-+    if (tracker.isUIForbidden())
-+      return NS_ERROR_NOT_AVAILABLE;
-+
-+    nsresult rv = dialogs->SetPassword(ctx,
-+                                       tokenName.get(),
-+                                       &canceled);
-+    if (NS_FAILED(rv))
-+      return rv;
-+
-+    if (canceled)
-+      return NS_ERROR_NOT_AVAILABLE;
-   }
-- loser:
--  return rv;
-+  return NS_OK;
- }
- 
- 
- PSMContentDownloader::PSMContentDownloader(PRUint32 type)
-   : mByteData(nsnull),
-     mType(type),
-     mDoSilentDownload(PR_FALSE)
- {
-diff --git a/security/manager/ssl/src/nsNSSHelper.h b/security/manager/ssl/src/nsNSSHelper.h
---- a/security/manager/ssl/src/nsNSSHelper.h
-+++ b/security/manager/ssl/src/nsNSSHelper.h
-@@ -59,19 +59,16 @@ public:
- 
- };
- 
- //
- // Function to get the implementor for a certain set of NSS
- // specific dialogs.
- //
- 
--nsresult 
--getNSSDialogs(void **_result, REFNSIID aIID, const char *contract);
--
- extern "C" {
- // a "fake" unicode conversion function
- PRBool
- pip_ucs2_ascii_conversion_fn(PRBool toUnicode,
-                              unsigned char *inBuf,
-                              unsigned int inBufLen,
-                              unsigned char *outBuf,
-                              unsigned int maxOutBufLen,
-diff --git a/security/manager/ssl/src/nsNSSIOLayer.cpp b/security/manager/ssl/src/nsNSSIOLayer.cpp
---- a/security/manager/ssl/src/nsNSSIOLayer.cpp
-+++ b/security/manager/ssl/src/nsNSSIOLayer.cpp
-@@ -48,18 +48,16 @@
- #include "nsIPrompt.h"
- #include "nsIPrefService.h"
- #include "nsIPrefBranch.h"
- #include "nsIServiceManager.h"
- #include "nsIWebProgressListener.h"
- #include "nsIChannel.h"
- #include "nsNSSCertificate.h"
- #include "nsIX509CertValidity.h"
--#include "nsIProxyObjectManager.h"
--#include "nsProxiedService.h"
- #include "nsIDateTimeFormat.h"
- #include "nsDateTimeFormatCID.h"
- #include "nsIClientAuthDialogs.h"
- #include "nsClientAuthRemember.h"
- #include "nsICertOverrideService.h"
- #include "nsIBadCertListener2.h"
- #include "nsISSLErrorListener.h"
- #include "nsIObjectInputStream.h"
-@@ -83,16 +81,17 @@
- #include "nsIDocShell.h"
- #include "nsIDocShellTreeItem.h"
- #include "nsISecureBrowserUI.h"
- #include "nsProxyRelease.h"
- #include "nsIClassInfoImpl.h"
- #include "nsIProgrammingLanguage.h"
- #include "nsIArray.h"
- #include "nsCharSeparatedTokenizer.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- #include "ssl.h"
- #include "secerr.h"
- #include "sslerr.h"
- #include "secder.h"
- #include "secasn1.h"
- #include "certdb.h"
- #include "cert.h"
-@@ -360,22 +359,18 @@ nsNSSSocketInfo::EnsureDocShellDependent
-   if (mDocShellDependentStuffKnown)
-     return NS_OK;
- 
-   if (!mCallbacks || nsSSLThread::stoppedOrStopping())
-     return NS_ERROR_FAILURE;
- 
-   mDocShellDependentStuffKnown = PR_TRUE;
- 
--  nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
--  NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                       NS_GET_IID(nsIInterfaceRequestor),
--                       static_cast<nsIInterfaceRequestor*>(mCallbacks),
--                       NS_PROXY_SYNC,
--                       getter_AddRefs(proxiedCallbacks));
-+  nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks =
-+    new InterfaceRequestorProxy(mCallbacks);
- 
-   // Are we running within a context that wants external SSL error reporting?
-   // We'll look at the presence of a security UI object inside docshell.
-   // If the docshell wants the lock icon, you'll get the ssl error pages, too.
-   // This is helpful to distinguish from all other contexts, like mail windows,
-   // or any other SSL connections running in the background.
-   // We must query it now and remember, because fatal SSL errors will come 
-   // with a socket close, and the socket transport might detach the callbacks 
-@@ -384,45 +379,34 @@ nsNSSSocketInfo::EnsureDocShellDependent
-   nsISecureBrowserUI* secureUI = nsnull;
-   CallGetInterface(proxiedCallbacks.get(), &secureUI);
- 
-   nsCOMPtr<nsIDocShell> docshell;
- 
-   nsCOMPtr<nsIDocShellTreeItem> item(do_GetInterface(proxiedCallbacks));
-   if (item)
-   {
--    nsCOMPtr<nsIDocShellTreeItem> proxiedItem;
-+    nsCOMPtr<nsIDocShellTreeItem> proxiedItem =
-+      new DocShellTreeItemProxy(item);
-+
-     nsCOMPtr<nsIDocShellTreeItem> rootItem;
--    NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                         NS_GET_IID(nsIDocShellTreeItem),
--                         item.get(),
--                         NS_PROXY_SYNC,
--                         getter_AddRefs(proxiedItem));
--
-     proxiedItem->GetSameTypeRootTreeItem(getter_AddRefs(rootItem));
-     docshell = do_QueryInterface(rootItem);
-     NS_ASSERTION(docshell, "rootItem do_QI is null");
-   }
- 
-   if (docshell && !secureUI)
-   {
--    nsCOMPtr<nsIDocShell> proxiedDocShell;
--    NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                         NS_GET_IID(nsIDocShell),
--                         docshell.get(),
--                         NS_PROXY_SYNC,
--                         getter_AddRefs(proxiedDocShell));
--    if (proxiedDocShell)
--      proxiedDocShell->GetSecurityUI(&secureUI);
-+    nsCOMPtr<nsIDocShell> proxiedDocShell =
-+      new DocShellProxy(docshell);
-+    proxiedDocShell->GetSecurityUI(&secureUI);
-   }
- 
-   if (secureUI)
-   {
--    nsCOMPtr<nsIThread> mainThread(do_GetMainThread());
--    NS_ProxyRelease(mainThread, secureUI, PR_FALSE);
-     mExternalErrorReporting = PR_TRUE;
- 
-     // If this socket is associated to a docshell, let's try to remember
-     // the currently used cert. If this socket gets a notification from NSS
-     // having the same raw socket, we can keep the PSM wrapper object
-     // and all the data it has cached (like verification results).
-     nsCOMPtr<nsISSLStatusProvider> statprov = do_QueryInterface(secureUI);
-     if (statprov) {
-@@ -430,16 +414,18 @@ nsNSSSocketInfo::EnsureDocShellDependent
-       statprov->GetSSLStatus(getter_AddRefs(isup_stat));
-       if (isup_stat) {
-         nsCOMPtr<nsISSLStatus> sslstat = do_QueryInterface(isup_stat);
-         if (sslstat) {
-           sslstat->GetServerCert(getter_AddRefs(mPreviousCert));
-         }
-       }
-     }
-+    nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
-+    NS_ProxyRelease(mainThread, secureUI, PR_FALSE);
-   }
- 
-   return NS_OK;
- }
- 
- nsresult
- nsNSSSocketInfo::GetExternalErrorReporting(PRBool* state)
- {
-@@ -565,22 +551,18 @@ NS_IMETHODIMP nsNSSSocketInfo::GetInterf
-     if (!ir)
-       return NS_ERROR_OUT_OF_MEMORY;
- 
-     rv = ir->GetInterface(uuid, result);
-   } else {
-     if (nsSSLThread::stoppedOrStopping())
-       return NS_ERROR_FAILURE;
- 
--    nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
--    NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                         NS_GET_IID(nsIInterfaceRequestor),
--                         mCallbacks,
--                         NS_PROXY_SYNC,
--                         getter_AddRefs(proxiedCallbacks));
-+    nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks =
-+      new InterfaceRequestorProxy(mCallbacks);
- 
-     rv = proxiedCallbacks->GetInterface(uuid, result);
-   }
-   return rv;
- }
- 
- nsresult
- nsNSSSocketInfo::GetForSTARTTLS(PRBool* aForSTARTTLS)
-@@ -1411,35 +1393,27 @@ static nsresult
- displayAlert(nsAFlatString &formattedString, nsNSSSocketInfo *infoObject)
- {
-   // The interface requestor object may not be safe, so proxy the call to get
-   // the nsIPrompt.
- 
-   if (nsSSLThread::stoppedOrStopping())
-     return NS_ERROR_FAILURE;
- 
--  nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
--  NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                       NS_GET_IID(nsIInterfaceRequestor),
--                       static_cast<nsIInterfaceRequestor*>(infoObject),
--                       NS_PROXY_SYNC,
--                       getter_AddRefs(proxiedCallbacks));
-+  nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks =
-+    new InterfaceRequestorProxy(infoObject);
- 
-   nsCOMPtr<nsIPrompt> prompt (do_GetInterface(proxiedCallbacks));
-   if (!prompt)
-     return NS_ERROR_NO_INTERFACE;
- 
-   // Finally, get a proxy for the nsIPrompt
- 
--  nsCOMPtr<nsIPrompt> proxyPrompt;
--  NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                       NS_GET_IID(nsIPrompt),
--                       prompt,
--                       NS_PROXY_SYNC,
--                       getter_AddRefs(proxyPrompt));
-+  nsCOMPtr<nsIPrompt> proxyPrompt =
-+    new PromptProxy(prompt);
- 
-   proxyPrompt->Alert(nsnull, formattedString.get());
-   return NS_OK;
- }
- 
- static nsresult
- nsHandleSSLError(nsNSSSocketInfo *socketInfo, PRInt32 err)
- {
-@@ -1466,42 +1440,31 @@ nsHandleSSLError(nsNSSSocketInfo *socket
- 
-   PRInt32 port;
-   socketInfo->GetPort(&port);
- 
-   // Try to get a nsISSLErrorListener implementation from the socket consumer.
-   nsCOMPtr<nsIInterfaceRequestor> cb;
-   socketInfo->GetNotificationCallbacks(getter_AddRefs(cb));
-   if (cb) {
--    nsCOMPtr<nsIInterfaceRequestor> callbacks;
--    NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                         NS_GET_IID(nsIInterfaceRequestor),
--                         cb,
--                         NS_PROXY_SYNC,
--                         getter_AddRefs(callbacks));
-+    nsCOMPtr<nsIInterfaceRequestor> callbacks =
-+      new InterfaceRequestorProxy(cb);
- 
-     nsCOMPtr<nsISSLErrorListener> sel = do_GetInterface(callbacks);
-     if (sel) {
--      nsISSLErrorListener *proxy_sel = nsnull;
--      NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                           NS_GET_IID(nsISSLErrorListener),
--                           sel,
--                           NS_PROXY_SYNC,
--                           (void**)&proxy_sel);
--      if (proxy_sel) {
--        nsIInterfaceRequestor *csi = static_cast<nsIInterfaceRequestor*>(socketInfo);
--        PRBool suppressMessage = PR_FALSE;
--        nsCString hostWithPortString = hostName;
--        hostWithPortString.AppendLiteral(":");
--        hostWithPortString.AppendInt(port);
--        rv = proxy_sel->NotifySSLError(csi, err, hostWithPortString, 
--                                       &suppressMessage);
--        if (NS_SUCCEEDED(rv) && suppressMessage)
--          return NS_OK;
--      }
-+      sel = new SSLErrorListenerProxy(sel);
-+      
-+      PRBool suppressMessage = PR_FALSE;
-+      nsCString hostWithPortString = hostName;
-+      hostWithPortString.AppendLiteral(":");
-+      hostWithPortString.AppendInt(port);
-+      rv = sel->NotifySSLError(socketInfo, err, hostWithPortString, 
-+                               &suppressMessage);
-+      if (NS_SUCCEEDED(rv) && suppressMessage)
-+        return NS_OK;
-     }
-   }
- 
-   PRBool external = PR_FALSE;
-   socketInfo->GetExternalErrorReporting(&external);
-   
-   nsString formattedString;
-   rv = getErrorMessage(err, hostNameU, port, external, nssComponent, formattedString);
-@@ -1565,38 +1528,37 @@ nsHandleInvalidCertError(nsNSSSocketInfo
-   }
-   else
-   {
-     nsPSMUITracker tracker;
-     if (tracker.isUIForbidden()) {
-       rv = NS_ERROR_NOT_AVAILABLE;
-     }
-     else {
--      nsISSLCertErrorDialog *dialogs = nsnull;
--      rv = getNSSDialogs((void**)&dialogs, 
--        NS_GET_IID(nsISSLCertErrorDialog), 
--        NS_SSLCERTERRORDIALOG_CONTRACTID);
--  
--      if (NS_SUCCEEDED(rv)) {
-+      nsCOMPtr<nsISSLCertErrorDialog> dialogs =
-+        do_GetService(NS_SSLCERTERRORDIALOG_CONTRACTID);
-+      if (dialogs) {
-+        dialogs = new SSLCertErrorDialogProxy(dialogs);
-         nsPSMUITracker tracker;
-         if (tracker.isUIForbidden()) {
-           rv = NS_ERROR_NOT_AVAILABLE;
-         }
-         else {
-           nsCOMPtr<nsISSLStatus> status;
-           socketInfo->GetSSLStatus(getter_AddRefs(status));
- 
-           nsString empty;
- 
-           rv = dialogs->ShowCertError(nsnull, status, ix509, 
-                                       formattedString, 
-                                       empty, host, port);
-         }
--  
--        NS_RELEASE(dialogs);
-+      }
-+      else {
-+        rv = NS_ERROR_FAILURE;
-       }
-     }
-   }
-   return rv;
- }
- 
- static PRStatus PR_CALLBACK
- nsSSLIOLayerConnect(PRFileDesc* fd, const PRNetAddr* addr,
-@@ -3096,17 +3058,16 @@ if (hasRemembered)
-         }
-       }
-     }
- }
- 
- if (!hasRemembered)
- {
-     /* user selects a cert to present */
--    nsIClientAuthDialogs *dialogs = NULL;
-     PRInt32 selectedIndex = -1;
-     PRUnichar **certNicknameList = NULL;
-     PRUnichar **certDetailsList = NULL;
- 
-     /* find all user certs that are for SSL */
-     /* note that we are allowing expired certs in this list */
-     certList = CERT_FindUserCertsByUsage(CERT_GetDefaultCertDB(), 
-                                          certUsageSSLClient, PR_FALSE, 
-@@ -3226,26 +3187,27 @@ if (!hasRemembered)
-         nsMemory::Free(certNicknameList[CertsToUse]);
-         continue;
-       }
- 
-       ++CertsToUse;
-     }
- 
-     /* Throw up the client auth dialog and get back the index of the selected cert */
--    rv = getNSSDialogs((void**)&dialogs, 
--                       NS_GET_IID(nsIClientAuthDialogs),
--                       NS_CLIENTAUTHDIALOGS_CONTRACTID);
--
--    if (NS_FAILED(rv)) {
-+    nsCOMPtr<nsIClientAuthDialogs> dialogs =
-+      do_GetService(NS_CLIENTAUTHDIALOGS_CONTRACTID);
-+    if (!dialogs) {
-+      rv = NS_ERROR_FAILURE;
-       NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certNicknameList);
-       NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certDetailsList);
-       goto loser;
-     }
- 
-+    dialogs = new ClientAuthDialogsProxy(dialogs);
-+
-     {
-       nsPSMUITracker tracker;
-       if (tracker.isUIForbidden()) {
-         rv = NS_ERROR_NOT_AVAILABLE;
-       }
-       else {
-         rv = dialogs->ChooseCertificate(info, cn_host_port.get(), org.get(), issuer.get(), 
-           (const PRUnichar**)certNicknameList, (const PRUnichar**)certDetailsList,
-@@ -3517,23 +3479,19 @@ nsNSSBadCertHandler(void *arg, PRFileDes
-   remaining_display_errors = collected_errors;
- 
-   // Enforce Strict-Transport-Security for hosts that are "STS" hosts:
-   // connections must be dropped when there are any certificate errors
-   // (STS Spec section 7.3).
- 
-   nsCOMPtr<nsIStrictTransportSecurityService> stss
-     = do_GetService(NS_STSSERVICE_CONTRACTID);
--  nsCOMPtr<nsIStrictTransportSecurityService> proxied_stss;
--
--  nsrv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                              NS_GET_IID(nsIStrictTransportSecurityService),
--                              stss, NS_PROXY_SYNC,
--                              getter_AddRefs(proxied_stss));
--  NS_ENSURE_SUCCESS(nsrv, SECFailure);
-+
-+  nsCOMPtr<nsIStrictTransportSecurityService> proxied_stss =
-+    new StrictTransportSecurityServiceProxy(stss);
- 
-   // now grab the host name to pass to the STS Service
-   nsXPIDLCString hostName;
-   nsrv = infoObject->GetHostName(getter_Copies(hostName));
-   NS_ENSURE_SUCCESS(nsrv, SECFailure);
- 
-   PRBool strictTransportSecurityEnabled;
-   nsrv = proxied_stss->IsStsHost(hostName, &strictTransportSecurityEnabled);
-@@ -3577,36 +3535,26 @@ nsNSSBadCertHandler(void *arg, PRFileDes
- 
-   PRBool suppressMessage = PR_FALSE;
-   nsresult rv;
- 
-   // Try to get a nsIBadCertListener2 implementation from the socket consumer.
-   nsCOMPtr<nsIInterfaceRequestor> cb;
-   infoObject->GetNotificationCallbacks(getter_AddRefs(cb));
-   if (cb) {
--    nsCOMPtr<nsIInterfaceRequestor> callbacks;
--    NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                         NS_GET_IID(nsIInterfaceRequestor),
--                         cb,
--                         NS_PROXY_SYNC,
--                         getter_AddRefs(callbacks));
-+    nsCOMPtr<nsIInterfaceRequestor> callbacks =
-+      new InterfaceRequestorProxy(cb);
- 
-     nsCOMPtr<nsIBadCertListener2> bcl = do_GetInterface(callbacks);
-     if (bcl) {
--      nsCOMPtr<nsIBadCertListener2> proxy_bcl;
--      NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                           NS_GET_IID(nsIBadCertListener2),
--                           bcl,
--                           NS_PROXY_SYNC,
--                           getter_AddRefs(proxy_bcl));
--      if (proxy_bcl) {
--        nsIInterfaceRequestor *csi = static_cast<nsIInterfaceRequestor*>(infoObject);
--        rv = proxy_bcl->NotifyCertProblem(csi, status, hostWithPortString, 
--                                          &suppressMessage);
--      }
-+      nsCOMPtr<nsIBadCertListener2> proxy_bcl =
-+        new BadCertListener2Proxy(bcl);
-+
-+      rv = proxy_bcl->NotifyCertProblem(infoObject, status, hostWithPortString, 
-+                                        &suppressMessage);
-     }
-   }
- 
-   nsCOMPtr<nsIRecentBadCertsService> recentBadCertsService = 
-     do_GetService(NS_RECENTBADCERTS_CONTRACTID);
- 
-   if (recentBadCertsService) {
-     recentBadCertsService->AddBadCert(hostWithPortStringUTF16, status);
-diff --git a/security/manager/ssl/src/nsPKCS12Blob.cpp b/security/manager/ssl/src/nsPKCS12Blob.cpp
---- a/security/manager/ssl/src/nsPKCS12Blob.cpp
-+++ b/security/manager/ssl/src/nsPKCS12Blob.cpp
-@@ -41,33 +41,33 @@
- 
- #include "nsISupportsArray.h"
- #include "nsIFile.h"
- #include "nsNetUtil.h"
- #include "nsILocalFile.h"
- #include "nsIDirectoryService.h"
- #include "nsIWindowWatcher.h"
- #include "nsIPrompt.h"
--#include "nsProxiedService.h"
- #include "nsThreadUtils.h"
- 
- #include "nsNSSComponent.h"
- #include "nsNSSHelper.h"
- #include "nsPKCS12Blob.h"
- #include "nsString.h"
- #include "nsReadableUtils.h"
- #include "nsXPIDLString.h"
- #include "nsDirectoryServiceDefs.h"
- #include "nsNSSHelper.h"
- #include "nsNSSCertificate.h"
- #include "nsKeygenHandler.h" //For GetSlotWithMechanism
- #include "nsPK11TokenDB.h"
- #include "nsICertificateDialogs.h"
- #include "nsNSSShutDown.h"
- #include "nsCRT.h"
-+#include "nsSyncRunnableHelpers.h"
- #include "pk11func.h"
- #include "secerr.h"
- 
- #ifdef PR_LOGGING
- extern PRLogModuleInfo* gPIPNSSLog;
- #endif
- 
- #include "nsNSSCleaner.h"
-@@ -524,21 +524,23 @@ nsPKCS12Blob::unicodeToItem(const PRUnic
- //
- // Launch a dialog requesting the user for a new PKCS#12 file passowrd.
- // Handle user canceled by returning null password (caller must catch).
- nsresult
- nsPKCS12Blob::newPKCS12FilePassword(SECItem *unicodePw)
- {
-   nsresult rv = NS_OK;
-   nsAutoString password;
--  nsCOMPtr<nsICertificateDialogs> certDialogs;
--  rv = ::getNSSDialogs(getter_AddRefs(certDialogs), 
--                       NS_GET_IID(nsICertificateDialogs),
--                       NS_CERTIFICATEDIALOGS_CONTRACTID);
--  if (NS_FAILED(rv)) return rv;
-+  nsCOMPtr<nsICertificateDialogs> certDialogs =
-+    do_GetService(NS_CERTIFICATEDIALOGS_CONTRACTID);
-+  if (!certDialogs)
-+    return NS_ERROR_FAILURE;
-+
-+  certDialogs = new CertificateDialogsProxy(certDialogs);
-+
-   PRBool pressedOK;
-   {
-     nsPSMUITracker tracker;
-     if (tracker.isUIForbidden()) {
-       rv = NS_ERROR_NOT_AVAILABLE;
-     }
-     else {
-       rv = certDialogs->SetPKCS12FilePassword(mUIContext, password, &pressedOK);
-@@ -553,21 +555,24 @@ nsPKCS12Blob::newPKCS12FilePassword(SECI
- //
- // Launch a dialog requesting the user for the password to a PKCS#12 file.
- // Handle user canceled by returning null password (caller must catch).
- nsresult
- nsPKCS12Blob::getPKCS12FilePassword(SECItem *unicodePw)
- {
-   nsresult rv = NS_OK;
-   nsAutoString password;
--  nsCOMPtr<nsICertificateDialogs> certDialogs;
--  rv = ::getNSSDialogs(getter_AddRefs(certDialogs), 
--                       NS_GET_IID(nsICertificateDialogs),
--                       NS_CERTIFICATEDIALOGS_CONTRACTID);
--  if (NS_FAILED(rv)) return rv;
-+
-+  nsCOMPtr<nsICertificateDialogs> certDialogs =
-+    do_GetService(NS_CERTIFICATEDIALOGS_CONTRACTID);
-+  if (!certDialogs)
-+    return NS_ERROR_FAILURE;
-+
-+  certDialogs = new CertificateDialogsProxy(certDialogs);
-+
-   PRBool pressedOK;
-   {
-     nsPSMUITracker tracker;
-     if (tracker.isUIForbidden()) {
-       rv = NS_ERROR_NOT_AVAILABLE;
-     }
-     else {
-       rv = certDialogs->GetPKCS12FilePassword(mUIContext, password, &pressedOK);
-@@ -844,21 +849,18 @@ nsPKCS12Blob::handleError(int myerr)
-   PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("PKCS12: I called(%d)", myerr));
-   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
-   if (NS_FAILED(rv)) return;
-   nsCOMPtr<nsIPrompt> errPrompt;
-   nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
-   if (wwatch) {
-     wwatch->GetNewPrompter(0, getter_AddRefs(errPrompt));
-     if (errPrompt) {
--      nsCOMPtr<nsIPrompt> proxyPrompt;
--      NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                           NS_GET_IID(nsIPrompt), errPrompt,
--                           NS_PROXY_SYNC, getter_AddRefs(proxyPrompt));
--      if (!proxyPrompt) return;
-+      nsCOMPtr<nsIPrompt> proxyPrompt =
-+        new PromptProxy(errPrompt);
-     } else {
-       return;
-     }
-   } else {
-     return;
-   }
-   nsAutoString errorMsg;
-   switch (myerr) {
-diff --git a/security/manager/ssl/src/nsProtectedAuthThread.cpp b/security/manager/ssl/src/nsProtectedAuthThread.cpp
---- a/security/manager/ssl/src/nsProtectedAuthThread.cpp
-+++ b/security/manager/ssl/src/nsProtectedAuthThread.cpp
-@@ -32,21 +32,21 @@
-  * 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 ***** */
- 
- #include "pk11func.h"
- #include "nsCOMPtr.h"
- #include "nsAutoPtr.h"
--#include "nsProxiedService.h"
- #include "nsString.h"
- #include "nsReadableUtils.h"
- #include "nsPKCS11Slot.h"
- #include "nsProtectedAuthThread.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- using namespace mozilla;
- 
- NS_IMPL_THREADSAFE_ISUPPORTS1(nsProtectedAuthThread, nsIProtectedAuthThread)
- 
- static void PR_CALLBACK nsProtectedAuthThreadRunner(void *arg)
- {
-     nsProtectedAuthThread *self = static_cast<nsProtectedAuthThread *>(arg);
-@@ -72,32 +72,23 @@ nsProtectedAuthThread::~nsProtectedAuthT
- NS_IMETHODIMP nsProtectedAuthThread::Login(nsIObserver *aObserver)
- {
-     NS_ENSURE_ARG(aObserver);
-     
-     if (!mSlot)
-         // We need pointer to the slot
-         return NS_ERROR_FAILURE;
- 
--    nsCOMPtr<nsIObserver> observerProxy;
--    nsresult rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                                       NS_GET_IID(nsIObserver),
--                                       aObserver,
--                                       NS_PROXY_SYNC | NS_PROXY_ALWAYS,
--                                       getter_AddRefs(observerProxy));
--    if (NS_FAILED(rv))
--        return rv;
--
-     MutexAutoLock lock(mMutex);
-     
-     if (mIAmRunning || mLoginReady) {
-         return NS_OK;
-     }
- 
--    observerProxy.swap(mStatusObserver);
-+    mStatusObserver = new ObserverProxy(aObserver);
-     mIAmRunning = PR_TRUE;
-     
-     mThreadHandle = PR_CreateThread(PR_USER_THREAD, nsProtectedAuthThreadRunner, static_cast<void*>(this), 
-         PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
-     
-     // bool thread_started_ok = (threadHandle != nsnull);
-     // we might want to return "thread started ok" to caller in the future
-     NS_ASSERTION(mThreadHandle, "Could not create nsProtectedAuthThreadRunner thread\n");
-diff --git a/security/manager/ssl/src/nsSDR.cpp b/security/manager/ssl/src/nsSDR.cpp
---- a/security/manager/ssl/src/nsSDR.cpp
-+++ b/security/manager/ssl/src/nsSDR.cpp
-@@ -45,18 +45,18 @@
- #include "nsString.h"
- #include "nsCOMPtr.h"
- #include "nsThreadUtils.h"
- #include "nsIInterfaceRequestor.h"
- #include "nsIInterfaceRequestorUtils.h"
- #include "nsIServiceManager.h"
- #include "nsIWindowWatcher.h"
- #include "nsIPrompt.h"
--#include "nsProxiedService.h"
- #include "nsITokenPasswordDialogs.h"
-+#include "nsSyncRunnableHelpers.h"
- 
- #include "nsISecretDecoderRing.h"
- #include "nsSDR.h"
- #include "nsNSSComponent.h"
- #include "nsNSSShutDown.h"
- 
- #include "pk11func.h"
- #include "pk11sdr.h" // For PK11SDR_Encrypt, PK11SDR_Decrypt
-@@ -101,26 +101,19 @@ NS_IMETHODIMP nsSDRContext::GetInterface
-   nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
-   if (NS_FAILED(rv))
-     return rv;
- 
-   rv = wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
-   if (!prompter)
-     return NS_ERROR_FAILURE;
- 
--  nsCOMPtr<nsIPrompt> proxyPrompt;
--  rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
--                            NS_GET_IID(nsIPrompt),
--                            prompter,
--                            NS_PROXY_SYNC,
--                            getter_AddRefs(proxyPrompt));
--  if (!proxyPrompt)
--    return NS_ERROR_FAILURE;
--  *result = proxyPrompt;
--  NS_ADDREF((nsIPrompt*)*result);
-+  nsCOMPtr<nsIPrompt> proxyPrompt =
-+    new PromptProxy(prompter);
-+  proxyPrompt.forget(reinterpret_cast<nsIPrompt**>(result));
- 
-   return NS_OK;
- }
- 
- // Standard ISupports implementation
- // NOTE: Should these be the thread-safe versions?
- NS_IMPL_ISUPPORTS2(nsSecretDecoderRing, nsISecretDecoderRing, nsISecretDecoderRingConfig)
- 
-@@ -298,22 +291,22 @@ ChangePassword()
-   if (!slot) return NS_ERROR_NOT_AVAILABLE;
- 
-   /* Convert UTF8 token name to UCS2 */
-   NS_ConvertUTF8toUTF16 tokenName(PK11_GetTokenName(slot));
- 
-   PK11_FreeSlot(slot);
- 
-   /* Get the set password dialog handler imlementation */
--  nsCOMPtr<nsITokenPasswordDialogs> dialogs;
-+  nsCOMPtr<nsITokenPasswordDialogs> dialogs =
-+    do_GetService(NS_TOKENPASSWORDSDIALOG_CONTRACTID);
-+  if (!dialogs)
-+    return NS_ERROR_FAILURE;
- 
--  rv = getNSSDialogs(getter_AddRefs(dialogs),
--                     NS_GET_IID(nsITokenPasswordDialogs),
--                     NS_TOKENPASSWORDSDIALOG_CONTRACTID);
--  if (NS_FAILED(rv)) return rv;
-+  dialogs = new TokenPasswordDialogsProxy(dialogs);
- 
-   nsCOMPtr<nsIInterfaceRequestor> ctx = new nsSDRContext();
-   PRBool canceled;
- 
-   {
-     nsPSMUITracker tracker;
-     if (tracker.isUIForbidden()) {
-       rv = NS_ERROR_NOT_AVAILABLE;
-diff --git a/security/manager/ssl/src/nsSyncRunnableHelpers.cpp b/security/manager/ssl/src/nsSyncRunnableHelpers.cpp
-new file mode 100644
---- /dev/null
-+++ b/security/manager/ssl/src/nsSyncRunnableHelpers.cpp
-@@ -0,0 +1,920 @@
-+/* ***** BEGIN LICENSE BLOCK *****
-+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-+ *
-+ * The contents of this file are subject to the Mozilla Public License Version
-+ * 1.1 (the "License"); you may not use this file except in compliance with
-+ * the License. You may obtain a copy of the License at
-+ * http://www.mozilla.org/MPL/
-+ *
-+ * Software distributed under the License is distributed on an "AS IS" basis,
-+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-+ * for the specific language governing rights and limitations under the
-+ * License.
-+ *
-+ * The Original Code is Mozilla Firefox.
-+ *
-+ * The Initial Developer of the Original Code is
-+ * the Mozilla Foundation <http://www.mozilla.org/>.
-+ * Portions created by the Initial Developer are Copyright (C) 2011
-+ * the Initial Developer. All Rights Reserved.
-+ *
-+ * Contributor(s):
-+ *
-+ * Alternatively, the contents of this file may be used under the terms of
-+ * either the GNU General Public License Version 2 or later (the "GPL"), or
-+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-+ * in which case the provisions of the GPL or the LGPL are applicable instead
-+ * of those above. If you wish to allow use of your version of this file only
-+ * under the terms of either the GPL or the LGPL, and not to allow others to
-+ * use your version of this file under the terms of the MPL, indicate your
-+ * decision by deleting the provisions above and replace them with the notice
-+ * and other provisions required by the GPL or the LGPL. If you do not delete
-+ * 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 ***** */
-+
-+#include "nsSyncRunnableHelpers.h"
-+
-+#include "mozilla/Monitor.h"
-+
-+NS_IMPL_THREADSAFE_ISUPPORTS1(ObserverProxy, nsIObserver)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(InterfaceRequestorProxy, nsIInterfaceRequestor)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(PromptProxy, nsIPrompt)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(SecurityWarningDialogsProxy,
-+                              nsISecurityWarningDialogs)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(TokenPasswordDialogsProxy,
-+                              nsITokenPasswordDialogs)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(DocShellTreeItemProxy, nsIDocShellTreeItem)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(DocShellProxy, nsIDocShell)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(SSLErrorListenerProxy, nsISSLErrorListener)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(StrictTransportSecurityServiceProxy,
-+                              nsIStrictTransportSecurityService)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(BadCertListener2Proxy, nsIBadCertListener2)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(X509CertProxy, nsIX509Cert)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(X509CertValidityProxy, nsIX509CertValidity)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(FormSigningDialogProxy, nsIFormSigningDialog)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(TokenDialogsProxy, nsITokenDialogs)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(SSLCertErrorDialogProxy,
-+                              nsISSLCertErrorDialog)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(ClientAuthDialogsProxy, nsIClientAuthDialogs)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(CertificateDialogsProxy, nsICertificateDialogs)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(GeneratingKeypairInfoDialogsProxy,
-+                              nsIGeneratingKeypairInfoDialogs)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(DOMCryptoDialogsProxy, nsIDOMCryptoDialogs)
-+NS_IMPL_THREADSAFE_ISUPPORTS1(CertPickDialogsProxy, nsICertPickDialogs)
-+
-+namespace {
-+
-+// Traits class for a reference type, specialized for parameters which are
-+// already references.
-+template<typename T>
-+struct RefType
-+{
-+  typedef T& type;
-+};
-+
-+template<>
-+struct RefType<nsAString&>
-+{
-+  typedef nsAString& type;
-+};
-+
-+template<>
-+struct RefType<const nsAString&>
-+{
-+  typedef const nsAString& type;
-+};
-+
-+template<>
-+struct RefType<nsACString&>
-+{
-+  typedef nsACString& type;
-+};
-+
-+template<>
-+struct RefType<const nsACString&>
-+{
-+  typedef const nsACString& type;
-+};
-+
-+template<>
-+struct RefType<const nsIID&>
-+{
-+  typedef const nsIID& type;
-+};
-+
-+class SyncRunnableBase : public nsRunnable
-+{
-+public:
-+  nsresult Result() {
-+    return mResult;
-+  }
-+
-+  mozilla::Monitor& Monitor() {
-+    return mMonitor;
-+  }
-+
-+protected:
-+  SyncRunnableBase()
-+    : mResult(NS_ERROR_UNEXPECTED)
-+    , mMonitor("SyncRunnableBase")
-+  { }
-+
-+  nsresult mResult;
-+  mozilla::Monitor mMonitor;
-+};
-+
-+template<typename Receiver, typename Arg1>
-+class SyncRunnable1 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+
-+  SyncRunnable1(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+};
-+
-+template<typename Receiver, typename Arg1, typename Arg2>
-+class SyncRunnable2 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1, Arg2);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+  typedef typename RefType<Arg2>::type Arg2Ref;
-+
-+  SyncRunnable2(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1, Arg2Ref arg2)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+    , mArg2(arg2)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1, mArg2);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+  Arg2Ref mArg2;
-+};
-+
-+template<typename Receiver, typename Arg1, typename Arg2, typename Arg3>
-+class SyncRunnable3 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1, Arg2, Arg3);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+  typedef typename RefType<Arg2>::type Arg2Ref;
-+  typedef typename RefType<Arg3>::type Arg3Ref;
-+
-+  SyncRunnable3(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1, Arg2Ref arg2, Arg3Ref arg3)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+    , mArg2(arg2)
-+    , mArg3(arg3)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1, mArg2, mArg3);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+  Arg2Ref mArg2;
-+  Arg3Ref mArg3;
-+};
-+
-+template<typename Receiver, typename Arg1, typename Arg2, typename Arg3,
-+         typename Arg4>
-+class SyncRunnable4 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1, Arg2, Arg3, Arg4);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+  typedef typename RefType<Arg2>::type Arg2Ref;
-+  typedef typename RefType<Arg3>::type Arg3Ref;
-+  typedef typename RefType<Arg4>::type Arg4Ref;
-+
-+  SyncRunnable4(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1, Arg2Ref arg2, Arg3Ref arg3, Arg4Ref arg4)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+    , mArg2(arg2)
-+    , mArg3(arg3)
-+    , mArg4(arg4)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1, mArg2, mArg3, mArg4);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+  Arg2Ref mArg2;
-+  Arg3Ref mArg3;
-+  Arg4Ref mArg4;
-+};
-+
-+template<typename Receiver, typename Arg1, typename Arg2, typename Arg3,
-+         typename Arg4, typename Arg5>
-+class SyncRunnable5 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1, Arg2, Arg3, Arg4, Arg5);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+  typedef typename RefType<Arg2>::type Arg2Ref;
-+  typedef typename RefType<Arg3>::type Arg3Ref;
-+  typedef typename RefType<Arg4>::type Arg4Ref;
-+  typedef typename RefType<Arg5>::type Arg5Ref;
-+
-+  SyncRunnable5(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1, Arg2Ref arg2, Arg3Ref arg3, Arg4Ref arg4, Arg5Ref arg5)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+    , mArg2(arg2)
-+    , mArg3(arg3)
-+    , mArg4(arg4)
-+    , mArg5(arg5)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+  Arg2Ref mArg2;
-+  Arg3Ref mArg3;
-+  Arg4Ref mArg4;
-+  Arg5Ref mArg5;
-+};
-+
-+template<typename Receiver, typename Arg1, typename Arg2, typename Arg3,
-+         typename Arg4, typename Arg5, typename Arg6>
-+class SyncRunnable6 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1, Arg2, Arg3, Arg4, Arg5,
-+                                               Arg6);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+  typedef typename RefType<Arg2>::type Arg2Ref;
-+  typedef typename RefType<Arg3>::type Arg3Ref;
-+  typedef typename RefType<Arg4>::type Arg4Ref;
-+  typedef typename RefType<Arg5>::type Arg5Ref;
-+  typedef typename RefType<Arg6>::type Arg6Ref;
-+
-+  SyncRunnable6(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1, Arg2Ref arg2, Arg3Ref arg3, Arg4Ref arg4, Arg5Ref arg5,
-+                Arg6Ref arg6)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+    , mArg2(arg2)
-+    , mArg3(arg3)
-+    , mArg4(arg4)
-+    , mArg5(arg5)
-+    , mArg6(arg6)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+  Arg2Ref mArg2;
-+  Arg3Ref mArg3;
-+  Arg4Ref mArg4;
-+  Arg5Ref mArg5;
-+  Arg6Ref mArg6;
-+};
-+
-+template<typename Receiver, typename Arg1, typename Arg2, typename Arg3,
-+         typename Arg4, typename Arg5, typename Arg6, typename Arg7>
-+class SyncRunnable7 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1, Arg2, Arg3, Arg4, Arg5,
-+                                               Arg6, Arg7);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+  typedef typename RefType<Arg2>::type Arg2Ref;
-+  typedef typename RefType<Arg3>::type Arg3Ref;
-+  typedef typename RefType<Arg4>::type Arg4Ref;
-+  typedef typename RefType<Arg5>::type Arg5Ref;
-+  typedef typename RefType<Arg6>::type Arg6Ref;
-+  typedef typename RefType<Arg7>::type Arg7Ref;
-+
-+  SyncRunnable7(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1, Arg2Ref arg2, Arg3Ref arg3, Arg4Ref arg4, Arg5Ref arg5,
-+                Arg6Ref arg6, Arg7Ref arg7)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+    , mArg2(arg2)
-+    , mArg3(arg3)
-+    , mArg4(arg4)
-+    , mArg5(arg5)
-+    , mArg6(arg6)
-+    , mArg7(arg7)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6, mArg7);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+  Arg2Ref mArg2;
-+  Arg3Ref mArg3;
-+  Arg4Ref mArg4;
-+  Arg5Ref mArg5;
-+  Arg6Ref mArg6;
-+  Arg7Ref mArg7;
-+};
-+
-+template<typename Receiver, typename Arg1, typename Arg2, typename Arg3,
-+         typename Arg4, typename Arg5, typename Arg6, typename Arg7,
-+         typename Arg8>
-+class SyncRunnable8 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1, Arg2, Arg3, Arg4, Arg5,
-+                                               Arg6, Arg7, Arg8);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+  typedef typename RefType<Arg2>::type Arg2Ref;
-+  typedef typename RefType<Arg3>::type Arg3Ref;
-+  typedef typename RefType<Arg4>::type Arg4Ref;
-+  typedef typename RefType<Arg5>::type Arg5Ref;
-+  typedef typename RefType<Arg6>::type Arg6Ref;
-+  typedef typename RefType<Arg7>::type Arg7Ref;
-+  typedef typename RefType<Arg8>::type Arg8Ref;
-+
-+  SyncRunnable8(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1, Arg2Ref arg2, Arg3Ref arg3, Arg4Ref arg4, Arg5Ref arg5,
-+                Arg6Ref arg6, Arg7Ref arg7, Arg8Ref arg8)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+    , mArg2(arg2)
-+    , mArg3(arg3)
-+    , mArg4(arg4)
-+    , mArg5(arg5)
-+    , mArg6(arg6)
-+    , mArg7(arg7)
-+    , mArg8(arg8)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6, mArg7, mArg8);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+  Arg2Ref mArg2;
-+  Arg3Ref mArg3;
-+  Arg4Ref mArg4;
-+  Arg5Ref mArg5;
-+  Arg6Ref mArg6;
-+  Arg7Ref mArg7;
-+  Arg8Ref mArg8;
-+};
-+
-+template<typename Receiver, typename Arg1, typename Arg2, typename Arg3,
-+         typename Arg4, typename Arg5, typename Arg6, typename Arg7,
-+         typename Arg8, typename Arg9>
-+class SyncRunnable9 : public SyncRunnableBase
-+{
-+public:
-+  typedef nsresult (NS_STDCALL Receiver::*ReceiverMethod)(Arg1, Arg2, Arg3, Arg4, Arg5,
-+                                               Arg6, Arg7, Arg8, Arg9);
-+  typedef typename RefType<Arg1>::type Arg1Ref;
-+  typedef typename RefType<Arg2>::type Arg2Ref;
-+  typedef typename RefType<Arg3>::type Arg3Ref;
-+  typedef typename RefType<Arg4>::type Arg4Ref;
-+  typedef typename RefType<Arg5>::type Arg5Ref;
-+  typedef typename RefType<Arg6>::type Arg6Ref;
-+  typedef typename RefType<Arg7>::type Arg7Ref;
-+  typedef typename RefType<Arg8>::type Arg8Ref;
-+  typedef typename RefType<Arg9>::type Arg9Ref;
-+
-+  SyncRunnable9(Receiver* receiver, ReceiverMethod method,
-+                Arg1Ref arg1, Arg2Ref arg2, Arg3Ref arg3, Arg4Ref arg4, Arg5Ref arg5,
-+                Arg6Ref arg6, Arg7Ref arg7, Arg8Ref arg8, Arg9Ref arg9)
-+    : mReceiver(receiver)
-+    , mMethod(method)
-+    , mArg1(arg1)
-+    , mArg2(arg2)
-+    , mArg3(arg3)
-+    , mArg4(arg4)
-+    , mArg5(arg5)
-+    , mArg6(arg6)
-+    , mArg7(arg7)
-+    , mArg8(arg8)
-+    , mArg9(arg9)
-+  { }
-+
-+  NS_IMETHOD Run() {
-+    mResult = (mReceiver->*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6, mArg7, mArg8, mArg9);
-+    mozilla::MonitorAutoLock(mMonitor).Notify();
-+    return NS_OK;
-+  }
-+
-+private:
-+  Receiver* mReceiver;
-+  ReceiverMethod mMethod;
-+  Arg1Ref mArg1;
-+  Arg2Ref mArg2;
-+  Arg3Ref mArg3;
-+  Arg4Ref mArg4;
-+  Arg5Ref mArg5;
-+  Arg6Ref mArg6;
-+  Arg7Ref mArg7;
-+  Arg8Ref mArg8;
-+  Arg9Ref mArg9;
-+};
-+
-+nsresult
-+DispatchSyncRunnable(SyncRunnableBase* r)
-+{
-+  if (NS_IsMainThread()) {
-+    r->Run();
-+  }
-+  else {
-+    mozilla::MonitorAutoLock lock(r->Monitor());
-+    nsresult rv = NS_DispatchToMainThread(r);
-+    if (NS_FAILED(rv))
-+      return rv;
-+    lock.Wait();
-+  }
-+  return r->Result();
-+}
-+
-+} // anonymous namespace
-+
-+#define NS_SYNCRUNNABLEMETHOD1(iface, method,                       \
-+                               arg1)                                \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1) {                     \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable1<nsI##iface, arg1>                           \
-+      (mReceiver, &nsI##iface::method, a1);                         \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_SYNCRUNNABLEMETHOD2(iface, method,                       \
-+                               arg1, arg2)                          \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2) {            \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable2<nsI##iface, arg1, arg2>                     \
-+      (mReceiver, &nsI##iface::method, a1, a2);                     \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_SYNCRUNNABLEMETHOD3(iface, method,                       \
-+                               arg1, arg2, arg3)                    \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3) {   \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable3<nsI##iface, arg1, arg2, arg3>               \
-+      (mReceiver, &nsI##iface::method,                              \
-+       a1, a2, a3);                                                 \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_SYNCRUNNABLEMETHOD4(iface, method,                       \
-+                               arg1, arg2, arg3, arg4)              \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3, arg4 a4) { \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable4<nsI##iface, arg1, arg2, arg3, arg4>         \
-+      (mReceiver, &nsI##iface::method,                              \
-+       a1, a2, a3, a4);                                             \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_SYNCRUNNABLEMETHOD5(iface, method,                       \
-+                               arg1, arg2, arg3, arg4, arg5)        \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3, arg4 a4, arg5 a5) {   \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable5<nsI##iface, arg1, arg2, arg3, arg4, arg5>   \
-+      (mReceiver, &nsI##iface::method,                              \
-+       a1, a2, a3, a4, a5);                                         \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_SYNCRUNNABLEMETHOD6(iface, method,                       \
-+                               arg1, arg2, arg3, arg4, arg5, arg6)  \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3, arg4 a4, arg5 a5, arg6 a6) { \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable6<nsI##iface, arg1, arg2, arg3, arg4, arg5, arg6> \
-+      (mReceiver, &nsI##iface::method,                              \
-+       a1, a2, a3, a4, a5, a6);                                     \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_SYNCRUNNABLEMETHOD7(iface, method,                       \
-+                               arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3, arg4 a4, arg5 a5, arg6 a6, arg7 a7) { \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable7<nsI##iface, arg1, arg2, arg3, arg4, arg5, arg6, arg7> \
-+      (mReceiver, &nsI##iface::method,                              \
-+       a1, a2, a3, a4, a5, a6, a7);                                 \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_SYNCRUNNABLEMETHOD8(iface, method,                       \
-+                               arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3, arg4 a4, arg5 a5, arg6 a6, arg7 a7, arg8 a8) { \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable8<nsI##iface, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8> \
-+      (mReceiver, &nsI##iface::method,                              \
-+       a1, a2, a3, a4, a5, a6, a7, a8);                             \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_SYNCRUNNABLEMETHOD9(iface, method,                       \
-+                               arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
-+  NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3, arg4 a4, arg5 a5, arg6 a6, arg7 a7, arg8 a8, arg9 a9) { \
-+    nsRefPtr<SyncRunnableBase> r =                                  \
-+      new SyncRunnable9<nsI##iface, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9> \
-+        (mReceiver, &nsI##iface::method,                            \
-+         a1, a2, a3, a4, a5, a6, a7, a8, a9);                       \
-+    return DispatchSyncRunnable(r);                                 \
-+  }
-+
-+#define NS_NOTIMPLEMENTED \
-+  { NS_RUNTIMEABORT("Not implemented"); return NS_ERROR_UNEXPECTED; }
-+
-+NS_SYNCRUNNABLEMETHOD3(Observer, Observe,
-+                       nsISupports*, const char*, const PRUnichar*)
-+
-+NS_SYNCRUNNABLEMETHOD2(InterfaceRequestor, GetInterface,
-+                       const nsIID&, void**)
-+
-+NS_SYNCRUNNABLEMETHOD2(Prompt, Alert,
-+                       const PRUnichar*, const PRUnichar*)
-+NS_SYNCRUNNABLEMETHOD4(Prompt, AlertCheck,
-+                       const PRUnichar*, const PRUnichar*, const PRUnichar*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD3(Prompt, Confirm,
-+                       const PRUnichar*, const PRUnichar*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD5(Prompt, ConfirmCheck,
-+                       const PRUnichar*, const PRUnichar*, const PRUnichar*,
-+                       PRBool*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD9(Prompt, ConfirmEx,
-+                       const PRUnichar*, const PRUnichar*, PRUint32,
-+                       const PRUnichar*, const PRUnichar*,
-+                       const PRUnichar*, const PRUnichar*, PRBool*, PRInt32*)
-+NS_SYNCRUNNABLEMETHOD6(Prompt, Prompt,
-+                       const PRUnichar*, const PRUnichar*,
-+                       PRUnichar**, const PRUnichar*,
-+                       PRBool*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD6(Prompt, PromptPassword,
-+                       const PRUnichar*, const PRUnichar*,
-+                       PRUnichar**, const PRUnichar*,
-+                       PRBool*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD7(Prompt, PromptUsernameAndPassword,
-+                       const PRUnichar*, const PRUnichar*,
-+                       PRUnichar**, PRUnichar**,
-+                       const PRUnichar*, PRBool*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD6(Prompt, Select,
-+                       const PRUnichar*, const PRUnichar*,
-+                       PRUint32, const PRUnichar**,
-+                       PRInt32*, PRBool*)
-+
-+NS_SYNCRUNNABLEMETHOD2(SecurityWarningDialogs, ConfirmEnteringSecure,
-+                       nsIInterfaceRequestor*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD2(SecurityWarningDialogs, ConfirmEnteringWeak,
-+                       nsIInterfaceRequestor*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD2(SecurityWarningDialogs, ConfirmLeavingSecure,
-+                       nsIInterfaceRequestor*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD2(SecurityWarningDialogs, ConfirmMixedMode,
-+                       nsIInterfaceRequestor*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD2(SecurityWarningDialogs, ConfirmPostToInsecure,
-+                       nsIInterfaceRequestor*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD2(SecurityWarningDialogs,
-+                       ConfirmPostToInsecureFromSecure,
-+                       nsIInterfaceRequestor*, PRBool*)
-+
-+NS_SYNCRUNNABLEMETHOD3(TokenPasswordDialogs, SetPassword,
-+                       nsIInterfaceRequestor*, const PRUnichar*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD4(TokenPasswordDialogs, GetPassword,
-+                       nsIInterfaceRequestor*, const PRUnichar*,
-+                       PRUnichar**, PRBool*)
-+
-+// nsIDocShellTreeNode
-+
-+NS_IMETHODIMP DocShellTreeItemProxy::GetChildCount(PRInt32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::AddChild(nsIDocShellTreeItem*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::RemoveChild(nsIDocShellTreeItem*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::GetChildAt(PRInt32, nsIDocShellTreeItem**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::FindChildWithName(const PRUnichar*, PRBool, PRBool,
-+                                                       nsIDocShellTreeItem*, nsIDocShellTreeItem*,
-+                                                       nsIDocShellTreeItem**)
-+  NS_NOTIMPLEMENTED
-+
-+// nsIDocShellTreeItem
-+
-+NS_IMETHODIMP DocShellTreeItemProxy::GetName(PRUnichar**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::SetName(const PRUnichar*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::NameEquals(const PRUnichar*, PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::GetItemType(PRInt32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::SetItemType(PRInt32) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::GetParent(nsIDocShellTreeItem**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::GetSameTypeParent(nsIDocShellTreeItem**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::GetRootTreeItem(nsIDocShellTreeItem**) NS_NOTIMPLEMENTED
-+
-+NS_SYNCRUNNABLEMETHOD1(DocShellTreeItem, GetSameTypeRootTreeItem,
-+                       nsIDocShellTreeItem**)
-+
-+NS_IMETHODIMP DocShellTreeItemProxy::FindItemWithName(const PRUnichar*, nsISupports*,
-+                                                      nsIDocShellTreeItem*, nsIDocShellTreeItem**)
-+  NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::GetTreeOwner(nsIDocShellTreeOwner**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellTreeItemProxy::SetTreeOwner(nsIDocShellTreeOwner*) NS_NOTIMPLEMENTED
-+
-+// nsIDocShell
-+
-+NS_IMETHODIMP DocShellProxy::LoadURI(nsIURI*, nsIDocShellLoadInfo*, PRUint32, PRBool)
-+  NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::LoadStream(nsIInputStream*, nsIURI*, const nsACString&,
-+                                        const nsACString&, nsIDocShellLoadInfo*)
-+  NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::InternalLoad(nsIURI*, nsIURI*, nsISupports*, PRUint32,
-+                                          const PRUnichar*, const char*,
-+                                          nsIInputStream*, nsIInputStream*, PRUint32,
-+                                          nsISHEntry*, PRBool, nsIDocShell**, nsIRequest**)
-+  NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::AddState(nsIVariant*, const nsAString&, const nsAString&,
-+                                      PRBool, JSContext*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::CreateLoadInfo(nsIDocShellLoadInfo**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::PrepareForNewContentModel() NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetCurrentURI(nsIURI*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::FirePageHideNotification(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetPresContext(nsPresContext**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetPresShell(nsIPresShell**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetEldestPresShell(nsIPresShell**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetContentViewer(nsIContentViewer**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetChromeEventHandler(nsIDOMEventTarget**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetChromeEventHandler(nsIDOMEventTarget*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetDocumentCharsetInfo(nsIDocumentCharsetInfo**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetDocumentCharsetInfo(nsIDocumentCharsetInfo*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAllowPlugins(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAllowPlugins(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAllowJavascript(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAllowJavascript(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAllowMetaRedirects(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAllowMetaRedirects(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAllowSubframes(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAllowSubframes(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAllowImages(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAllowImages(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAllowDNSPrefetch(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAllowDNSPrefetch(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAllowWindowControl(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAllowWindowControl(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetDocShellEnumerator(PRInt32, PRInt32, nsISimpleEnumerator**)
-+  NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAppType(PRUint32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAppType(PRUint32) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetAllowAuth(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetAllowAuth(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetZoom(float*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetZoom(float) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetMarginWidth(PRInt32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetMarginWidth(PRInt32) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetMarginHeight(PRInt32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetMarginHeight(PRInt32) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::TabToTreeOwner(PRBool, PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetBusyFlags(PRUint32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetLoadType(PRUint32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetLoadType(PRUint32) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::IsBeingDestroyed(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetIsExecutingOnLoadHandler(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetLayoutHistoryState(nsILayoutHistoryState**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetLayoutHistoryState(nsILayoutHistoryState*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetShouldSaveLayoutState(PRBool*) NS_NOTIMPLEMENTED
-+NS_SYNCRUNNABLEMETHOD1(DocShell, GetSecurityUI,
-+                       nsISecureBrowserUI**)
-+NS_IMETHODIMP DocShellProxy::SetSecurityUI(nsISecureBrowserUI*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SuspendRefreshURIs() NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::ResumeRefreshURIs() NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::BeginRestore(nsIContentViewer*, PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::FinishRestore() NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetRestoringDocument(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetUseErrorPages(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetUseErrorPages(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetPreviousTransIndex(PRInt32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetLoadedTransIndex(PRInt32*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::HistoryPurged(PRInt32) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetSessionStorageForURI(nsIURI*, const nsAString&,
-+                                   nsIDOMStorage**)
-+  NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetSessionStorageForPrincipal(nsIPrincipal*, const nsAString&,
-+                                         PRBool, nsIDOMStorage**)
-+  NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::AddSessionStorage(nsIPrincipal*, nsIDOMStorage*)
-+  NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetCurrentDocumentChannel(nsIChannel**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetChildOffset(PRUint32) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetIsInUnload(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetChannelIsUnsafe(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP_(void) DocShellProxy::DetachEditorFromWindow() {
-+  NS_RUNTIMEABORT("Not implemented.");
-+}
-+NS_IMETHODIMP DocShellProxy::GetIsOffScreenBrowser(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetIsOffScreenBrowser(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetPrintPreview(nsIWebBrowserPrint**) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetCanExecuteScripts(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetIsActive(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetIsActive(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetHistoryID(PRUint64*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::GetIsAppTab(PRBool*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::SetIsAppTab(PRBool) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP DocShellProxy::CreateAboutBlankContentViewer(nsIPrincipal*) NS_NOTIMPLEMENTED
-+
-+NS_SYNCRUNNABLEMETHOD4(SSLErrorListener, NotifySSLError,
-+                       nsIInterfaceRequestor*, PRInt32,
-+                       const nsACString&, PRBool*)
-+
-+// nsIStrictTransportSecurityService
-+
-+NS_IMETHODIMP StrictTransportSecurityServiceProxy::ProcessStsHeader(nsIURI*, const char*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP StrictTransportSecurityServiceProxy::RemoveStsState(nsIURI*) NS_NOTIMPLEMENTED
-+NS_IMETHODIMP StrictTransportSecurityServiceProxy::ShouldIgnoreStsHeader(nsISupports*, PRBool*) NS_NOTIMPLEMENTED
-+NS_SYNCRUNNABLEMETHOD2(StrictTransportSecurityService, IsStsHost,
-+                       const char*, PRBool*)
-+NS_IMETHODIMP StrictTransportSecurityServiceProxy::IsStsURI(nsIURI*, PRBool*) NS_NOTIMPLEMENTED
-+
-+NS_SYNCRUNNABLEMETHOD4(BadCertListener2, NotifyCertProblem,
-+                       nsIInterfaceRequestor*, nsISSLStatus*,
-+                       const nsACString&, PRBool*)
-+
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetNickname,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetEmailAddress,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD2(X509Cert, GetEmailAddresses,
-+                       PRUint32*, PRUnichar***)
-+NS_SYNCRUNNABLEMETHOD2(X509Cert, ContainsEmailAddress,
-+                       const nsAString&, PRBool*)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetSubjectName,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetCommonName,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetOrganization,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetOrganizationalUnit,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetSha1Fingerprint,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetMd5Fingerprint,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetTokenName,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetIssuerName,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetSerialNumber,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetIssuerCommonName,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetIssuerOrganization,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetIssuerOrganizationUnit,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetIssuer,
-+                       nsIX509Cert**)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetValidity,
-+                       nsIX509CertValidity**)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetDbKey,
-+                       char**)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetWindowTitle,
-+                       char**)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetChain,
-+                       nsIArray**)
-+NS_SYNCRUNNABLEMETHOD4(X509Cert, GetUsagesArray,
-+                       PRBool, PRUint32*, PRUint32*, PRUnichar***)
-+NS_SYNCRUNNABLEMETHOD3(X509Cert, GetUsagesString,
-+                       PRBool, PRUint32*, nsAString&)
-+NS_SYNCRUNNABLEMETHOD2(X509Cert, VerifyForUsage,
-+                       PRUint32, PRUint32*)
-+NS_SYNCRUNNABLEMETHOD1(X509Cert, GetASN1Structure,
-+                       nsIASN1Object**)
-+NS_SYNCRUNNABLEMETHOD2(X509Cert, GetRawDER,
-+                       PRUint32*, PRUint8**)
-+NS_SYNCRUNNABLEMETHOD2(X509Cert, Equals,
-+                       nsIX509Cert*, PRBool*)
-+
-+NS_SYNCRUNNABLEMETHOD1(X509CertValidity, GetNotBefore,
-+                       PRTime*)
-+NS_SYNCRUNNABLEMETHOD1(X509CertValidity, GetNotBeforeLocalTime,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509CertValidity, GetNotBeforeLocalDay,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509CertValidity, GetNotBeforeGMT,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509CertValidity, GetNotAfter,
-+                       PRTime*)
-+NS_SYNCRUNNABLEMETHOD1(X509CertValidity, GetNotAfterLocalTime,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509CertValidity, GetNotAfterLocalDay,
-+                       nsAString&)
-+NS_SYNCRUNNABLEMETHOD1(X509CertValidity, GetNotAfterGMT,
-+                       nsAString&)
-+
-+
-+NS_SYNCRUNNABLEMETHOD9(FormSigningDialog, ConfirmSignText,
-+                       nsIInterfaceRequestor*, const nsAString&,
-+                       const nsAString&, const PRUnichar**,
-+                       const PRUnichar**, PRUint32,
-+                       PRInt32*, nsAString&, PRBool*)
-+
-+NS_SYNCRUNNABLEMETHOD5(TokenDialogs, ChooseToken,
-+                       nsIInterfaceRequestor*, const PRUnichar**,
-+                       PRUint32, PRUnichar**, PRBool*)
-+NS_SYNCRUNNABLEMETHOD2(TokenDialogs, DisplayProtectedAuth,
-+                       nsIInterfaceRequestor*, nsIProtectedAuthThread*)
-+
-+NS_SYNCRUNNABLEMETHOD7(SSLCertErrorDialog, ShowCertError,
-+                       nsIInterfaceRequestor*, nsISSLStatus*,
-+                       nsIX509Cert*, const nsAString&,
-+                       const nsAString&, const nsACString&, PRUint32)
-+
-+NS_SYNCRUNNABLEMETHOD9(ClientAuthDialogs, ChooseCertificate,
-+                       nsIInterfaceRequestor*, const PRUnichar*,
-+                       const PRUnichar*, const PRUnichar*,
-+                       const PRUnichar**, const PRUnichar**,
-+                       PRUint32, PRInt32*, PRBool*)
-+
-+NS_SYNCRUNNABLEMETHOD4(CertificateDialogs, ConfirmDownloadCACert,
-+                       nsIInterfaceRequestor*, nsIX509Cert*,
-+                       PRUint32*, PRBool*)
-+NS_SYNCRUNNABLEMETHOD1(CertificateDialogs, NotifyCACertExists,
-+                       nsIInterfaceRequestor*)
-+NS_SYNCRUNNABLEMETHOD3(CertificateDialogs, SetPKCS12FilePassword,
-+                       nsIInterfaceRequestor*, nsAString&, PRBool*)
-+NS_SYNCRUNNABLEMETHOD3(CertificateDialogs, GetPKCS12FilePassword,
-+                       nsIInterfaceRequestor*, nsAString&, PRBool*)
-+NS_SYNCRUNNABLEMETHOD2(CertificateDialogs, ViewCert,
-+                       nsIInterfaceRequestor*, nsIX509Cert*)
-+NS_SYNCRUNNABLEMETHOD2(CertificateDialogs, CrlImportStatusDialog,
-+                       nsIInterfaceRequestor*, nsICRLInfo*)
-+
-+NS_SYNCRUNNABLEMETHOD2(GeneratingKeypairInfoDialogs, DisplayGeneratingKeypairInfo,
-+                       nsIInterfaceRequestor*, nsIKeygenThread*)
-+
-+
-+NS_SYNCRUNNABLEMETHOD2(DOMCryptoDialogs, ConfirmKeyEscrow,
-+                       nsIX509Cert*, PRBool*)
-+
-+NS_SYNCRUNNABLEMETHOD6(CertPickDialogs, PickCertificate,
-+                       nsIInterfaceRequestor*,
-+                       const PRUnichar**, const PRUnichar**,
-+                       PRUint32, PRInt32*, PRBool*)
-+
-diff --git a/security/manager/ssl/src/nsSyncRunnableHelpers.h b/security/manager/ssl/src/nsSyncRunnableHelpers.h
-new file mode 100644
---- /dev/null
-+++ b/security/manager/ssl/src/nsSyncRunnableHelpers.h
-@@ -0,0 +1,362 @@
-+/* ***** BEGIN LICENSE BLOCK *****
-+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-+ *
-+ * The contents of this file are subject to the Mozilla Public License Version
-+ * 1.1 (the "License"); you may not use this file except in compliance with
-+ * the License. You may obtain a copy of the License at
-+ * http://www.mozilla.org/MPL/
-+ *
-+ * Software distributed under the License is distributed on an "AS IS" basis,
-+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-+ * for the specific language governing rights and limitations under the
-+ * License.
-+ *
-+ * The Original Code is Mozilla Firefox.
-+ *
-+ * The Initial Developer of the Original Code is
-+ * the Mozilla Foundation <http://www.mozilla.org/>.
-+ * Portions created by the Initial Developer are Copyright (C) 2011
-+ * the Initial Developer. All Rights Reserved.
-+ *
-+ * Contributor(s):
-+ *
-+ * Alternatively, the contents of this file may be used under the terms of
-+ * either the GNU General Public License Version 2 or later (the "GPL"), or
-+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-+ * in which case the provisions of the GPL or the LGPL are applicable instead
-+ * of those above. If you wish to allow use of your version of this file only
-+ * under the terms of either the GPL or the LGPL, and not to allow others to
-+ * use your version of this file under the terms of the MPL, indicate your
-+ * decision by deleting the provisions above and replace them with the notice
-+ * and other provisions required by the GPL or the LGPL. If you do not delete
-+ * 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 nsSyncRunnableHelpers_h
-+#define nsSyncRunnableHelpers_h
-+
-+#include "nsThreadUtils.h"
-+
-+#include "nsIObserver.h"
-+#include "nsISecurityWarningDialogs.h"
-+#include "nsIInterfaceRequestor.h"
-+#include "nsIPrompt.h"
-+#include "nsITokenPasswordDialogs.h"
-+#include "nsIDocShellTreeItem.h"
-+#include "nsIDocShell.h"
-+#include "nsISSLErrorListener.h"
-+#include "nsIStrictTransportSecurityService.h"
-+#include "nsIBadCertListener2.h"
-+#include "nsIX509Cert.h"
-+#include "nsIX509CertValidity.h"
-+#include "nsIFormSigningDialog.h"
-+#include "nsITokenDialogs.h"
-+#include "nsISSLCertErrorDialog.h"
-+#include "nsIClientAuthDialogs.h"
-+#include "nsICertificateDialogs.h"
-+#include "nsIGenKeypairInfoDlg.h"
-+#include "nsIDOMCryptoDialogs.h"
-+#include "nsICertPickDialogs.h"
-+
-+// The classes in this file proxy method calls to the main thread
-+// synchronously. The main thread must not block on this thread, or a
-+// deadlock condition can occur.
-+
-+class ObserverProxy : public nsIObserver
-+{
-+public:
-+  ObserverProxy(nsIObserver* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIOBSERVER
-+
-+private:
-+  nsCOMPtr<nsIObserver> mReceiver;
-+};
-+
-+class InterfaceRequestorProxy : public nsIInterfaceRequestor
-+{
-+public:
-+  InterfaceRequestorProxy(nsIInterfaceRequestor* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIINTERFACEREQUESTOR
-+
-+private:
-+  nsCOMPtr<nsIInterfaceRequestor> mReceiver;
-+};
-+
-+class PromptProxy : public nsIPrompt
-+{
-+public:
-+  PromptProxy(nsIPrompt* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIPROMPT
-+
-+private:
-+  nsCOMPtr<nsIPrompt> mReceiver;
-+};
-+                         
-+class SecurityWarningDialogsProxy : public nsISecurityWarningDialogs
-+{
-+public:
-+  SecurityWarningDialogsProxy(nsISecurityWarningDialogs* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSISECURITYWARNINGDIALOGS
-+
-+private:
-+  nsCOMPtr<nsISecurityWarningDialogs> mReceiver;
-+};
-+
-+class TokenPasswordDialogsProxy : public nsITokenPasswordDialogs
-+{
-+public:
-+  TokenPasswordDialogsProxy(nsITokenPasswordDialogs* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSITOKENPASSWORDDIALOGS
-+
-+private:
-+  nsCOMPtr<nsITokenPasswordDialogs> mReceiver;
-+};
-+
-+/**
-+ * This is a limited proxy which implements the single method that NSS needs:
-+ * GetSameTypeRootTreeItem.
-+ */ 
-+class DocShellTreeItemProxy : public nsIDocShellTreeItem
-+{
-+public:
-+  DocShellTreeItemProxy(nsIDocShellTreeItem* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIDOCSHELLTREENODE
-+  NS_DECL_NSIDOCSHELLTREEITEM
-+
-+private:
-+  nsCOMPtr<nsIDocShellTreeItem> mReceiver;
-+};
-+
-+/**
-+ * This is a limited proxy which implements the single method that NSS needs:
-+ * GetSecurityUI.
-+ */ 
-+class DocShellProxy : public nsIDocShell
-+{
-+public:
-+  DocShellProxy(nsIDocShell* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIDOCSHELL
-+
-+private:
-+  nsCOMPtr<nsIDocShell> mReceiver;
-+};
-+
-+class SSLErrorListenerProxy : public nsISSLErrorListener
-+{
-+public:
-+  SSLErrorListenerProxy(nsISSLErrorListener* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSISSLERRORLISTENER
-+
-+private:
-+  nsCOMPtr<nsISSLErrorListener> mReceiver;
-+};
-+
-+/**
-+ * Limited proxy class implements only IsStsHost.
-+ */
-+class StrictTransportSecurityServiceProxy :
-+  public nsIStrictTransportSecurityService
-+{
-+public:
-+  StrictTransportSecurityServiceProxy(
-+    nsIStrictTransportSecurityService* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSISTRICTTRANSPORTSECURITYSERVICE
-+
-+private:
-+  nsCOMPtr<nsIStrictTransportSecurityService> mReceiver;
-+};
-+
-+class BadCertListener2Proxy : public nsIBadCertListener2
-+{
-+public:
-+  BadCertListener2Proxy(nsIBadCertListener2* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIBADCERTLISTENER2
-+
-+private:
-+  nsCOMPtr<nsIBadCertListener2> mReceiver;
-+};
-+
-+class X509CertProxy : public nsIX509Cert
-+{
-+public:
-+  X509CertProxy(nsIX509Cert* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIX509CERT
-+
-+private:
-+  nsCOMPtr<nsIX509Cert> mReceiver;
-+};
-+
-+class X509CertValidityProxy : public nsIX509CertValidity
-+{
-+public:
-+  X509CertValidityProxy(nsIX509CertValidity* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIX509CERTVALIDITY
-+
-+private:
-+  nsCOMPtr<nsIX509CertValidity> mReceiver;
-+};
-+
-+class FormSigningDialogProxy : public nsIFormSigningDialog
-+{
-+public:
-+  FormSigningDialogProxy(nsIFormSigningDialog* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIFORMSIGNINGDIALOG
-+
-+private:
-+  nsCOMPtr<nsIFormSigningDialog> mReceiver;
-+};
-+
-+class TokenDialogsProxy : public nsITokenDialogs
-+{
-+public:
-+  TokenDialogsProxy(nsITokenDialogs* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSITOKENDIALOGS
-+
-+private:
-+  nsCOMPtr<nsITokenDialogs> mReceiver;
-+};
-+
-+class SSLCertErrorDialogProxy : public nsISSLCertErrorDialog
-+{
-+public:
-+  SSLCertErrorDialogProxy(nsISSLCertErrorDialog* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSISSLCERTERRORDIALOG
-+  
-+private:
-+  nsCOMPtr<nsISSLCertErrorDialog> mReceiver;
-+};
-+
-+class ClientAuthDialogsProxy : public nsIClientAuthDialogs
-+{
-+public:
-+  ClientAuthDialogsProxy(nsIClientAuthDialogs* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSICLIENTAUTHDIALOGS
-+
-+private:
-+  nsCOMPtr<nsIClientAuthDialogs> mReceiver;
-+};
-+
-+class CertificateDialogsProxy : public nsICertificateDialogs
-+{
-+public:
-+  CertificateDialogsProxy(nsICertificateDialogs* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSICERTIFICATEDIALOGS
-+
-+private:
-+  nsCOMPtr<nsICertificateDialogs> mReceiver;
-+};
-+
-+class GeneratingKeypairInfoDialogsProxy :
-+  public nsIGeneratingKeypairInfoDialogs
-+{
-+public:
-+  GeneratingKeypairInfoDialogsProxy(nsIGeneratingKeypairInfoDialogs* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIGENERATINGKEYPAIRINFODIALOGS
-+
-+private:
-+  nsCOMPtr<nsIGeneratingKeypairInfoDialogs> mReceiver;
-+};
-+
-+class DOMCryptoDialogsProxy : public nsIDOMCryptoDialogs
-+{
-+public:
-+  DOMCryptoDialogsProxy(nsIDOMCryptoDialogs* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSIDOMCRYPTODIALOGS
-+
-+private:
-+  nsCOMPtr<nsIDOMCryptoDialogs> mReceiver;
-+};
-+
-+class CertPickDialogsProxy : public nsICertPickDialogs
-+{
-+public:
-+  CertPickDialogsProxy(nsICertPickDialogs* receiver)
-+    : mReceiver(receiver)
-+  { }
-+
-+  NS_DECL_ISUPPORTS
-+  NS_DECL_NSICERTPICKDIALOGS
-+
-+private:
-+  nsCOMPtr<nsICertPickDialogs> mReceiver;
-+};
-+
-+#endif // nsSyncRunnableHelpers_h
deleted file mode 100644
--- a/bug675221-partG-define-HAS_STDCALL
+++ /dev/null
@@ -1,23 +0,0 @@
-# HG changeset patch
-# Parent 4c57c0dc34c99963b2fda73fd3a5b7fb27b235a1
-diff --git a/configure.in b/configure.in
---- a/configure.in
-+++ b/configure.in
-@@ -937,16 +937,17 @@ if test -n "$_WIN32_MSVC"; then
-     SKIP_COMPILER_CHECKS=1
-     SKIP_LIBRARY_CHECKS=1
- 
-     # Since we're skipping compiler and library checks, hard-code
-     # some facts here.
-     AC_DEFINE(HAVE_IO_H)
-     AC_DEFINE(HAVE_SETBUF)
-     AC_DEFINE(HAVE_ISATTY)
-+    AC_DEFINE(HAVE_STDCALL)
- fi
- 
- fi # COMPILE_ENVIRONMENT
- 
- AC_SUBST(MIDL_FLAGS)
- AC_SUBST(_MSC_VER)
- 
- AC_SUBST(GNU_AS)
--- a/series
+++ b/series
@@ -1,8 +1,2 @@
 bug675221-partA-xpcom
 bug675221-partB-unimplement
-bug675221-partC-necko
-bug675221-partD-urlclassifier
-bug675221-partE-domstorage
-bug675221-partF-psm
-bug675221-partG-define-HAS_STDCALL
-trychooser-mostlyeverything
deleted file mode 100644
--- a/trychooser-mostlyeverything
+++ /dev/null
@@ -1,4 +0,0 @@
-# HG changeset patch
-# Parent 84dbb0050bcbe2954394eec0188afa0f618e53bf
-try: -b do -p linux,linuxqt,linux64,macosx64,win32,linux-android,linux-maemo5-gtk,linux-maemo5-qt -u xpcshell,mochitest-1,mochitest-3,mochitest-5,mochitest-o -t none
-