static nsCOMPtr<nsIFactory>  g_pNSIFactory;
GetEditorShellFactory(nsIFactory **aFactory, const nsCID &aClass, const char *aClassName, const char *aProgID){  static nsCOMPtr<nsIFactory>  g_pNSIFactory;  PR_EnterMonitor(GetEditorMonitor());  nsresult result = NS_ERROR_FAILURE;  if (!g_pNSIFactory)  {    nsEditorShellFactoryImpl* factory = new nsEditorShellFactoryImpl(aClass, aClassName, aProgID);    g_pNSIFactory = do_QueryInterface(factory);    if (factory)      result = NS_OK;  }  result = g_pNSIFactory->QueryInterface(kIFactoryIID, (void **)aFactory);  PR_ExitMonitor(GetEditorMonitor());  return result;}