nsCOMPtr<nsISyncStreamListener> lsnr; static NS_DEFINE_CID(kSyncStreamListenerCID, NS_SYNCSTREAMLISTENER_CID); rv = nsComponentManager::CreateInstance(kSyncStreamListenerCID, nsnull, NS_GET_IID(nsISyncStreamListener), getter_AddRefs(lsnr)); if (NS_FAILED(rv)) return rv; rv = lsnr->Init(inStream, outStream);
NS_ENSURE_ARG_POINTER(aInStream); NS_ENSURE_ARG_POINTER(aOutStream);  nsCOMPtr<nsIInputStream> pipeIn; nsCOMPtr<nsIOutputStream> pipeOut;  rv = NS_NewPipe(getter_AddRefs(pipeIn), getter_AddRefs(pipeOut), 4*1024, 32*1024);
NS_NewSyncStreamListener(nsIInputStream **inStream,                          nsIOutputStream **outStream,                         nsIStreamListener **listener){    nsresult rv;    nsCOMPtr<nsISyncStreamListener> lsnr;    static NS_DEFINE_CID(kSyncStreamListenerCID, NS_SYNCSTREAMLISTENER_CID);    rv = nsComponentManager::CreateInstance(kSyncStreamListenerCID,                                            nsnull,                                             NS_GET_IID(nsISyncStreamListener),                                            getter_AddRefs(lsnr));    if (NS_FAILED(rv)) return rv;    rv = lsnr->Init(inStream, outStream);    if (NS_FAILED(rv)) return rv;    *listener = lsnr;    NS_ADDREF(*listener);    return NS_OK;}