bug 240920 - document nsIStreamLoader, document nsISimpleStreamListener some

more, and a bit of cleanup
r+sr=darin
This commit is contained in:
cbiesinger%web.de 2004-04-20 13:54:47 +00:00
Родитель df1789981a
Коммит 3b1866e5c0
5 изменённых файлов: 24 добавлений и 15 удалений

Просмотреть файл

@ -49,7 +49,8 @@ interface nsISimpleStreamListener : nsIStreamListener
/**
* Initialize the simple stream listener.
*
* @param aSink data will be read from the channel to this output stream
* @param aSink data will be read from the channel to this output stream.
* Must implement writeFrom.
* @param aObserver optional stream observer (can be NULL)
*/
void init(in nsIOutputStream aSink,

Просмотреть файл

@ -54,9 +54,25 @@ interface nsIStreamLoaderObserver : nsISupports
[size_is(resultLength)] in string result);
};
/**
* Asynchronously loads a channel into a memory buffer.
*/
[scriptable, uuid(31d37360-8e5a-11d3-93ad-00104ba0fd40)]
interface nsIStreamLoader : nsISupports
{
/**
* Initialize this stream loader, and start loading the data.
*
* @param aChannel
* A Channel to load data from. This must not be asyncOpen'd yet!
* @param aObserver
* An observer that will be notified when the data is complete.
* @param aContext
* May be null. Will be passed to the observer.
*
* @note Failure to open the channel will be indicated by an async callback
* to the observer.
*/
void init(in nsIChannel aChannel,
in nsIStreamLoaderObserver aObserver,
in nsISupports aContext);
@ -67,7 +83,8 @@ interface nsIStreamLoader : nsISupports
readonly attribute unsigned long numBytesRead;
/**
* Gets the request that loaded this file
* Gets the request that loaded this file.
* null after the request has finished loading.
*/
readonly attribute nsIRequest request;
};

Просмотреть файл

@ -37,10 +37,7 @@
#include "nsStreamLoader.h"
#include "nsIInputStream.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIChannel.h"
//#include "nsIHttpChannel.h"
#include "nsProxiedService.h"
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
@ -98,13 +95,7 @@ NS_IMPL_ISUPPORTS3(nsStreamLoader, nsIStreamLoader,
NS_IMETHODIMP
nsStreamLoader::GetNumBytesRead(PRUint32* aNumBytes)
{
if (!mData.IsEmpty()) {
*aNumBytes = mData.Length();
}
else {
*aNumBytes = 0;
}
*aNumBytes = mData.Length();
return NS_OK;
}

Просмотреть файл

@ -52,8 +52,8 @@ public:
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
nsStreamLoader() { };
virtual ~nsStreamLoader() {};
nsStreamLoader() { }
~nsStreamLoader() {}
static NS_METHOD
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);

Просмотреть файл

@ -93,7 +93,7 @@ net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result)
nsresult rv;
nsCOMPtr<nsILocalFile> localFile;
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(localFile));
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(localFile));
if (NS_FAILED(rv))
return rv;