зеркало из https://github.com/mozilla/pjs.git
Fixed wacky sync/async code in webbrowser persist b=69828, r=dougt@netscape.com
This commit is contained in:
Родитель
e76b4fd565
Коммит
3187316f0a
|
@ -75,12 +75,7 @@ nsWebBrowserPersist::~nsWebBrowserPersist()
|
|||
}
|
||||
|
||||
void nsWebBrowserPersist::CleanUp()
|
||||
{ if (mInputStream)
|
||||
{
|
||||
mInputStream->Close();
|
||||
mInputStream = nsnull;
|
||||
}
|
||||
mInputChannel = nsnull;
|
||||
{
|
||||
if (mOutputStream)
|
||||
{
|
||||
mOutputStream->Close();
|
||||
|
@ -195,8 +190,6 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
|
|||
|
||||
mOutputTransport = outputChannel;
|
||||
|
||||
//dougt wtf?! why both a async and sync read?
|
||||
|
||||
// Read from the input channel
|
||||
rv = inputChannel->AsyncOpen(this, nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -204,28 +197,6 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveURI(nsIURI *aURI, nsIInputStream *aPostDa
|
|||
OnEndDownload();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> inStream;
|
||||
rv = inputChannel->Open(getter_AddRefs(inStream));
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
OnEndDownload();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mInputChannel = inputChannel;
|
||||
mInputStream = inStream;
|
||||
|
||||
// Get the output channel ready for writing
|
||||
nsCOMPtr<nsIRequest> writeRequest;
|
||||
rv = NS_AsyncWriteFromStream(getter_AddRefs(writeRequest),
|
||||
outputChannel, inStream, 0, 0, 0,
|
||||
NS_STATIC_CAST(nsIStreamObserver*, this), nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
OnEndDownload();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -93,8 +93,6 @@ private:
|
|||
static PRBool PR_CALLBACK CleanupURIMap(nsHashKey *aKey, void *aData, void* closure);
|
||||
|
||||
nsCOMPtr<nsIMIMEService> mMIMEService;
|
||||
nsCOMPtr<nsIChannel> mInputChannel;
|
||||
nsCOMPtr<nsIInputStream> mInputStream;
|
||||
nsCOMPtr<nsITransport> mOutputTransport;
|
||||
nsCOMPtr<nsIOutputStream> mOutputStream;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
|
|
Загрузка…
Ссылка в новой задаче