Merge e10s -> m-c. a=wecanhazbeta

This commit is contained in:
Dan Witte 2010-08-23 21:18:09 -07:00
Родитель c88cd4e26c d4fa839364
Коммит bc83deed21
53 изменённых файлов: 173 добавлений и 238 удалений

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

@ -679,5 +679,5 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
}
}
NS_IMPL_ISUPPORTS1(nsScriptCacheCleaner, nsIObserver)
NS_IMPL_ISUPPORTS1(nsScriptCacheCleaner, nsIObserver);

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

@ -460,12 +460,12 @@ nsSyncLoadService::PushSyncStreamToListener(nsIInputStream* aIn,
nsresult rv;
nsCOMPtr<nsIInputStream> bufferedStream;
if (!NS_InputStreamIsBuffered(aIn)) {
PRInt32 chunkSize;
PRInt64 chunkSize;
rv = aChannel->GetContentLength(&chunkSize);
if (NS_FAILED(rv)) {
chunkSize = 4096;
}
chunkSize = NS_MIN(PRInt32(PR_UINT16_MAX), chunkSize);
chunkSize = NS_MIN(PRInt64(PR_UINT16_MAX), chunkSize);
rv = NS_NewBufferedInputStream(getter_AddRefs(bufferedStream), aIn,
chunkSize);

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

@ -2407,8 +2407,8 @@ NOT_IMPLEMENTED_IF_FUNC_1(GetContentType, nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(SetContentType, const nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(GetContentCharset, nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(SetContentCharset, const nsACString &value)
NOT_IMPLEMENTED_IF_FUNC_1(GetContentLength, PRInt32 *value)
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt32 value)
NOT_IMPLEMENTED_IF_FUNC_1(GetContentLength, PRInt64 *value)
NOT_IMPLEMENTED_IF_FUNC_1(SetContentLength, PRInt64 value)
NOT_IMPLEMENTED_IF_FUNC_1(Open, nsIInputStream **_retval)
NOT_IMPLEMENTED_IF_FUNC_2(AsyncOpen, nsIStreamListener *listener,
nsISupports *context)

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

@ -265,13 +265,13 @@ nsWyciwygChannel::SetContentCharset(const nsACString &aContentCharset)
}
NS_IMETHODIMP
nsWyciwygChannel::GetContentLength(PRInt32 *aContentLength)
nsWyciwygChannel::GetContentLength(PRInt64 *aContentLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsWyciwygChannel::SetContentLength(PRInt32 aContentLength)
nsWyciwygChannel::SetContentLength(PRInt64 aContentLength)
{
mContentLength = aContentLength;
@ -506,10 +506,9 @@ nsWyciwygChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctx,
rv = mListener->OnDataAvailable(this, mListenerContext, input, offset, count);
// XXX handle 64-bit stuff for real
if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
PRUint64(mContentLength));
mContentLength);
return rv; // let the pump cancel on failure
}

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

@ -94,7 +94,7 @@ protected:
PRPackedBool mNeedToWriteCharset;
PRInt32 mCharsetSource;
nsCString mCharset;
PRInt32 mContentLength;
PRInt64 mContentLength;
PRUint32 mLoadFlags;
nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIURI> mOriginalURI;

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

@ -240,7 +240,7 @@ nsMediaChannelStream::OnStartRequest(nsIRequest* aRequest)
responseStatus == HTTP_PARTIAL_RESPONSE_CODE)) {
// We weren't seeking and got a valid response status,
// set the length of the content.
PRInt32 cl = -1;
PRInt64 cl = -1;
hc->GetContentLength(&cl);
if (cl >= 0) {
mCacheStream.NotifyDataLength(cl);

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

@ -1012,13 +1012,13 @@ nsJSChannel::SetContentCharset(const nsACString &aContentCharset)
}
NS_IMETHODIMP
nsJSChannel::GetContentLength(PRInt32 *aContentLength)
nsJSChannel::GetContentLength(PRInt64 *aContentLength)
{
return mStreamChannel->GetContentLength(aContentLength);
}
NS_IMETHODIMP
nsJSChannel::SetContentLength(PRInt32 aContentLength)
nsJSChannel::SetContentLength(PRInt64 aContentLength)
{
return mStreamChannel->SetContentLength(aContentLength);
}

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

@ -905,7 +905,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(
}
}
PRInt32 channelContentLength = -1;
PRInt64 channelContentLength = -1;
if (!cancel &&
NS_SUCCEEDED(channel->GetContentLength(&channelContentLength)))
{

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

@ -350,7 +350,7 @@ class nsGnomeVFSInputStream : public nsIInputStream
: mSpec(uriSpec)
, mChannel(nsnull)
, mHandle(nsnull)
, mBytesRemaining(PR_UINT32_MAX)
, mBytesRemaining(LL_MAXUINT)
, mStatus(NS_OK)
, mDirList(nsnull)
, mDirListPtr(nsnull)
@ -386,7 +386,7 @@ class nsGnomeVFSInputStream : public nsIInputStream
nsCString mSpec;
nsIChannel *mChannel; // manually refcounted
GnomeVFSHandle *mHandle;
PRUint32 mBytesRemaining;
PRUint64 mBytesRemaining;
nsresult mStatus;
GList *mDirList;
GList *mDirListPtr;
@ -460,12 +460,11 @@ nsGnomeVFSInputStream::DoOpen()
if (info.mime_type && (strcmp(info.mime_type, APPLICATION_OCTET_STREAM) != 0))
SetContentTypeOfChannel(info.mime_type);
// XXX truncates size from 64-bit to 32-bit
mBytesRemaining = (PRUint32) info.size;
mBytesRemaining = info.size;
// Update the content length attribute on the channel. We do this
// synchronously without proxying. This hack is not as bad as it looks!
if (mBytesRemaining != PR_UINT32_MAX)
if (mBytesRemaining != PRUint64(-1))
mChannel->SetContentLength(mBytesRemaining);
}
else
@ -509,6 +508,7 @@ nsGnomeVFSInputStream::DoRead(char *aBuf, PRUint32 aCount, PRUint32 *aCountRead)
rv = gnome_vfs_read(mHandle, aBuf, aCount, &bytesRead);
if (rv == GNOME_VFS_OK)
{
// XXX 64-bit here
*aCountRead = (PRUint32) bytesRead;
mBytesRemaining -= *aCountRead;
}
@ -704,6 +704,7 @@ nsGnomeVFSInputStream::Available(PRUint32 *aResult)
if (NS_FAILED(mStatus))
return mStatus;
// XXX 64-bit here
*aResult = mBytesRemaining;
return NS_OK;
}

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

@ -216,7 +216,7 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL
/* load up the url. From here on, failures are reflected as ``custom''
* js exceptions */
PRInt32 len = -1;
PRInt64 len = -1;
PRUint32 readcount = 0; // Total amount of data read
PRUint32 lastReadCount = 0; // Amount of data read in last Read() call
nsAutoArrayPtr<char> buf;
@ -313,6 +313,9 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL
goto return_exception;
}
if (len > PR_INT32_MAX)
return NS_ERROR_OUT_OF_MEMORY;
buf = new char[len + 1];
if (!buf)
return NS_ERROR_OUT_OF_MEMORY;

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

@ -112,7 +112,7 @@ public:
NS_IF_ADDREF(*result = mJarReader);
}
PRInt32 GetContentLength()
PRInt64 GetContentLength()
{
return mContentLength;
}
@ -127,7 +127,7 @@ private:
nsCString mJarDirSpec;
nsCOMPtr<nsIInputStream> mJarStream;
nsCString mJarEntry;
PRInt32 mContentLength;
PRInt64 mContentLength;
};
NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputThunk, nsIInputStream)
@ -173,8 +173,11 @@ nsJARInputThunk::EnsureJarStream()
}
// ask the JarStream for the content length
rv = mJarStream->Available((PRUint32 *) &mContentLength);
// XXX want a 64-bit value from nsIInputStream::Available()
PRUint32 contentLength;
rv = mJarStream->Available(&contentLength);
if (NS_FAILED(rv)) return rv;
mContentLength = contentLength;
return NS_OK;
}
@ -629,7 +632,7 @@ nsJARChannel::SetContentCharset(const nsACString &aContentCharset)
}
NS_IMETHODIMP
nsJARChannel::GetContentLength(PRInt32 *result)
nsJARChannel::GetContentLength(PRInt64 *result)
{
// if content length is unknown, query mJarInput...
if (mContentLength < 0 && mJarInput)
@ -640,7 +643,7 @@ nsJARChannel::GetContentLength(PRInt32 *result)
}
NS_IMETHODIMP
nsJARChannel::SetContentLength(PRInt32 aContentLength)
nsJARChannel::SetContentLength(PRInt64 aContentLength)
{
// XXX does this really make any sense at all?
mContentLength = aContentLength;
@ -902,14 +905,14 @@ nsJARChannel::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
nsresult rv;
// XXX want 64-bit values in OnDataAvailable
rv = mListener->OnDataAvailable(this, mListenerContext, stream, offset, count);
// simply report progress here instead of hooking ourselves up as a
// nsITransportEventSink implementation.
// XXX do the 64-bit stuff for real
if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
PRUint64(mContentLength));
mContentLength);
return rv; // let the pump cancel on failure
}

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

@ -96,7 +96,7 @@ private:
nsCOMPtr<nsISupports> mListenerContext;
nsCString mContentType;
nsCString mContentCharset;
PRInt32 mContentLength;
PRInt64 mContentLength;
PRUint32 mLoadFlags;
nsresult mStatus;
PRPackedBool mIsPending;

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

@ -407,13 +407,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
{
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
{
NS_NOTREACHED("nsIconChannel::SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -69,7 +69,7 @@ public:
protected:
nsCOMPtr<nsIURI> mUrl;
nsCOMPtr<nsIURI> mOriginalURI;
PRInt32 mContentLength;
PRInt64 mContentLength;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsCOMPtr<nsISupports> mOwner;

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

@ -399,13 +399,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
{
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
{
NS_NOTREACHED("nsIconChannel::SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -636,13 +636,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
{
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
{
NS_NOTREACHED("nsIconChannel::SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -70,7 +70,7 @@ public:
protected:
nsCOMPtr<nsIURI> mUrl;
nsCOMPtr<nsIURI> mOriginalURI;
PRInt32 mContentLength;
PRInt64 mContentLength;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsCOMPtr<nsISupports> mOwner;

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

@ -693,13 +693,13 @@ nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt64 *aContentLength)
{
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt64 aContentLength)
{
NS_NOTREACHED("nsIconChannel::SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -72,7 +72,7 @@ public:
protected:
nsCOMPtr<nsIURI> mUrl;
nsCOMPtr<nsIURI> mOriginalURI;
PRInt32 mContentLength;
PRInt64 mContentLength;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsCOMPtr<nsISupports> mOwner;

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

@ -1085,16 +1085,13 @@ NS_IMETHODIMP imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctx
if (imageType == imgIContainer::TYPE_RASTER) {
/* Use content-length as a size hint for http channels. */
if (httpChannel) {
nsCAutoString contentLength;
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("content-length"),
contentLength);
PRInt64 contentLength;
rv = httpChannel->GetContentLength(&contentLength);
if (NS_SUCCEEDED(rv)) {
PRInt32 len = contentLength.ToInteger(&rv);
// Pass anything usable on so that the RasterImage can preallocate
// its source buffer
if (len > 0) {
PRUint32 sizeHint = (PRUint32) len;
if (contentLength > 0) {
PRUint32 sizeHint = (PRUint32) contentLength;
sizeHint = PR_MIN(sizeHint, 20000000); /* Bound by something reasonable */
RasterImage* rasterImage = static_cast<RasterImage*>(mImage.get());
rasterImage->SetSourceSizeHint(sizeHint);

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

@ -519,7 +519,7 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
if (loadGroup)
mWeakPtrChannelLoadGroup = do_GetWeakReference(loadGroup);
PRInt32 length;
PRInt64 length;
rv = channel->GetContentLength(&length);
// it's possible for the server to not send a Content-Length.

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

@ -136,7 +136,7 @@ private:
PRPackedBool mStartBinding;
PRPackedBool mHaveFiredOnStartRequest;
// these get passed to the plugin stream listener
PRUint32 mLength;
PRUint64 mLength;
PRInt32 mStreamType;
// local cached file, we save the content into local cache if browser cache is not available,

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

@ -50,14 +50,6 @@
*/
/**
* Content-Length of a channel. Used instead of the nsIChannel.contentLength
* property.
* Not available before onStartRequest has been called.
* Type: PRUint64
*/
#define NS_CHANNEL_PROP_CONTENT_LENGTH_STR "content-length"
/**
* MIME Content-Disposition header of channel.
* Not available before onStartRequest.
@ -73,12 +65,9 @@
#define NS_CHANNEL_PROP_CHANNEL_POLICY_STR "channel-policy"
#ifdef IMPL_NS_NET
#define NS_CHANNEL_PROP_CONTENT_LENGTH gNetStrings->kContentLength
#define NS_CHANNEL_PROP_CONTENT_DISPOSITION gNetStrings->kContentDisposition
#define NS_CHANNEL_PROP_CHANNEL_POLICY gNetStrings->kChannelPolicy
#else
#define NS_CHANNEL_PROP_CONTENT_LENGTH \
NS_LITERAL_STRING(NS_CHANNEL_PROP_CONTENT_LENGTH_STR)
#define NS_CHANNEL_PROP_CONTENT_DISPOSITION \
NS_LITERAL_STRING(NS_CHANNEL_PROP_CONTENT_DISPOSITION_STR)
#define NS_CHANNEL_PROP_CHANNEL_POLICY \

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

@ -56,7 +56,7 @@ interface nsIStreamListener;
*
* This interface must be used only from the XPCOM main thread.
*/
[scriptable, uuid(c63a055a-a676-4e71-bf3c-6cfa11082018)]
[scriptable, uuid(e0bb5c49-c54e-4efb-8f0d-6a7edd926fab)]
interface nsIChannel : nsIRequest
{
/**
@ -151,13 +151,11 @@ interface nsIChannel : nsIRequest
/**
* The length of the data associated with the channel if available. A value
* of -1 indicates that the content length is unknown.
*
* Callers should prefer getting the "content-length" property
* as 64-bit value by QIing the channel to nsIPropertyBag2,
* if that interface is exposed by the channel.
* of -1 indicates that the content length is unknown. Note that this
* is a 64-bit value and obsoletes the "content-length" property used on
* some channels.
*/
attribute long contentLength;
attribute PRInt64 contentLength;
/**
* Synchronously open the channel.

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

@ -47,8 +47,6 @@ class nsNetStrings {
public:
nsNetStrings();
/** "content-length" */
const nsLiteralString kContentLength;
const nsLiteralString kContentDisposition;
const nsLiteralString kChannelPolicy;
};

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

@ -86,7 +86,8 @@ private:
// nsBaseChannel
nsBaseChannel::nsBaseChannel()
: mLoadFlags(LOAD_NORMAL)
: mContentLength(-1)
, mLoadFlags(LOAD_NORMAL)
, mStatus(NS_OK)
, mQueriedProgressSink(PR_TRUE)
, mSynthProgressEvents(PR_FALSE)
@ -185,23 +186,6 @@ nsBaseChannel::HasContentTypeHint() const
return !mContentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE);
}
void
nsBaseChannel::SetContentLength64(PRInt64 len)
{
// XXX: Storing the content-length as a property may not be what we want.
// It has the drawback of being copied if we redirect this channel.
// Maybe it is time for nsIChannel2.
SetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH, len);
}
PRInt64
nsBaseChannel::ContentLength64()
{
PRInt64 len;
nsresult rv = GetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH, &len);
return NS_SUCCEEDED(rv) ? len : -1;
}
nsresult
nsBaseChannel::PushStreamConverter(const char *fromType,
const char *toType,
@ -222,7 +206,7 @@ nsBaseChannel::PushStreamConverter(const char *fromType,
if (NS_SUCCEEDED(rv)) {
mListener = converter;
if (invalidatesContentLength)
SetContentLength64(-1);
mContentLength = -1;
if (result) {
*result = nsnull;
converter.swap(*result);
@ -520,20 +504,16 @@ nsBaseChannel::SetContentCharset(const nsACString &aContentCharset)
}
NS_IMETHODIMP
nsBaseChannel::GetContentLength(PRInt32 *aContentLength)
nsBaseChannel::GetContentLength(PRInt64 *aContentLength)
{
PRInt64 len = ContentLength64();
if (len > PR_INT32_MAX || len < 0)
*aContentLength = -1;
else
*aContentLength = (PRInt32) len;
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP
nsBaseChannel::SetContentLength(PRInt32 aContentLength)
nsBaseChannel::SetContentLength(PRInt64 aContentLength)
{
SetContentLength64(aContentLength);
mContentLength = aContentLength;
return NS_OK;
}
@ -755,8 +735,7 @@ nsBaseChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
offset, count);
if (mSynthProgressEvents && NS_SUCCEEDED(rv)) {
PRUint64 prog = PRUint64(offset) + count;
PRUint64 progMax = ContentLength64();
OnTransportStatus(nsnull, nsITransport::STATUS_READING, prog, progMax);
OnTransportStatus(nsnull, nsITransport::STATUS_READING, prog, mContentLength);
}
return rv;

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

@ -185,10 +185,11 @@ public:
return mPump || mWaitingOnAsyncRedirect;
}
// Set the content length that should be reported for this channel. Pass -1
// to indicate an unspecified content length.
void SetContentLength64(PRInt64 len);
PRInt64 ContentLength64();
// Get or set the content length that should be reported for this channel. -1
// indicates an unspecified content length.
PRInt64& ContentLength() {
return mContentLength;
}
// Helper function for querying the channel's notification callbacks.
template <class T> void GetCallback(nsCOMPtr<T> &result) {
@ -289,6 +290,7 @@ private:
nsCOMPtr<nsIChannel> mRedirectChannel;
nsCString mContentType;
nsCString mContentCharset;
PRInt64 mContentLength;
PRUint32 mLoadFlags;
nsresult mStatus;
PRPackedBool mQueriedProgressSink;

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

@ -48,7 +48,6 @@
#include "nsIServiceManager.h"
#include "nsILocalFile.h"
#include "nsITimer.h"
#include "nsInt64.h"
#include "nsNetUtil.h"
#include "nsAutoPtr.h"
#include "nsWeakReference.h"
@ -101,22 +100,22 @@ AppendToFile(nsILocalFile *lf, const char *data, PRUint32 len)
// maxSize may be -1 if unknown
static void
MakeRangeSpec(const nsInt64 &size, const nsInt64 &maxSize, PRInt32 chunkSize,
MakeRangeSpec(PRInt64 size, PRInt64 maxSize, PRInt32 chunkSize,
PRBool fetchRemaining, nsCString &rangeSpec)
{
rangeSpec.AssignLiteral("bytes=");
rangeSpec.AppendInt(PRInt64(size));
rangeSpec.AppendInt(size);
rangeSpec.Append('-');
if (fetchRemaining)
return;
nsInt64 end = size + nsInt64(chunkSize);
if (maxSize != nsInt64(-1) && end > maxSize)
PRInt64 end = size + chunkSize;
if (maxSize != -1 && end > maxSize)
end = maxSize;
end -= 1;
rangeSpec.AppendInt(PRInt64(end));
rangeSpec.AppendInt(end);
}
//-----------------------------------------------------------------------------
@ -165,8 +164,8 @@ private:
PRInt32 mChunkLen;
PRInt32 mChunkSize;
PRInt32 mInterval;
nsInt64 mTotalSize;
nsInt64 mCurrentSize;
PRInt64 mTotalSize;
PRInt64 mCurrentSize;
PRUint32 mLoadFlags;
PRInt32 mNonPartialCount;
nsresult mStatus;
@ -197,7 +196,7 @@ nsIncrementalDownload::nsIncrementalDownload()
nsresult
nsIncrementalDownload::FlushChunk()
{
NS_ASSERTION(mTotalSize != nsInt64(-1), "total size should be known");
NS_ASSERTION(mTotalSize != -1, "total size should be known");
if (mChunkLen == 0)
return NS_OK;
@ -206,7 +205,7 @@ nsIncrementalDownload::FlushChunk()
if (NS_FAILED(rv))
return rv;
mCurrentSize += nsInt64(mChunkLen);
mCurrentSize += mChunkLen;
mChunkLen = 0;
return NS_OK;
@ -219,8 +218,8 @@ nsIncrementalDownload::UpdateProgress()
if (mProgressSink)
mProgressSink->OnProgress(this, mObserverContext,
PRUint64(PRInt64(mCurrentSize) + mChunkLen),
PRUint64(PRInt64(mTotalSize)));
mCurrentSize + mChunkLen,
mTotalSize);
}
nsresult
@ -285,7 +284,7 @@ nsIncrementalDownload::ProcessTimeout()
if (NS_FAILED(rv))
return rv;
NS_ASSERTION(mCurrentSize != nsInt64(-1),
NS_ASSERTION(mCurrentSize != -1,
"we should know the current file size by now");
rv = ClearRequestHeader(http);
@ -294,7 +293,7 @@ nsIncrementalDownload::ProcessTimeout()
// Don't bother making a range request if we are just going to fetch the
// entire document.
if (mInterval || mCurrentSize != nsInt64(0)) {
if (mInterval || mCurrentSize != 0) {
nsCAutoString range;
MakeRangeSpec(mCurrentSize, mTotalSize, mChunkSize, mInterval == 0, range);
@ -319,8 +318,8 @@ nsIncrementalDownload::ProcessTimeout()
nsresult
nsIncrementalDownload::ReadCurrentSize()
{
nsInt64 size;
nsresult rv = mDest->GetFileSize((PRInt64 *) &size);
PRInt64 size;
nsresult rv = mDest->GetFileSize(&size);
if (rv == NS_ERROR_FILE_NOT_FOUND ||
rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
mCurrentSize = 0;
@ -553,7 +552,7 @@ nsIncrementalDownload::OnStartRequest(nsIRequest *request,
// We may already have the entire file downloaded, in which case
// our request for a range beyond the end of the file would have
// been met with an error response code.
if (code == 416 && mTotalSize == nsInt64(-1)) {
if (code == 416 && mTotalSize == -1) {
mTotalSize = mCurrentSize;
// Return an error code here to suppress OnDataAvailable.
return NS_ERROR_DOWNLOAD_COMPLETE;
@ -587,7 +586,7 @@ nsIncrementalDownload::OnStartRequest(nsIRequest *request,
}
// Do special processing after the first response.
if (mTotalSize == nsInt64(-1)) {
if (mTotalSize == -1) {
// Update knowledge of mFinalURI
rv = http->GetURI(getter_AddRefs(mFinalURI));
if (NS_FAILED(rv))
@ -605,18 +604,12 @@ nsIncrementalDownload::OnStartRequest(nsIRequest *request,
NS_WARNING("server returned invalid Content-Range header!");
return NS_ERROR_UNEXPECTED;
}
if (PR_sscanf(buf.get() + slash + 1, "%lld", (PRInt64 *) &mTotalSize) != 1)
if (PR_sscanf(buf.get() + slash + 1, "%lld", &mTotalSize) != 1)
return NS_ERROR_UNEXPECTED;
} else {
// Use nsIPropertyBag2 to fetch the content length as it exposes the
// value as a 64-bit number.
nsCOMPtr<nsIPropertyBag2> props = do_QueryInterface(request, &rv);
if (NS_FAILED(rv))
return rv;
rv = props->GetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH,
&mTotalSize.mValue);
http->GetContentLength(&mTotalSize);
// We need to know the total size of the thing we're trying to download.
if (mTotalSize == nsInt64(-1)) {
if (mTotalSize == -1) {
NS_WARNING("server returned no content-length header!");
return NS_ERROR_UNEXPECTED;
}
@ -633,13 +626,13 @@ nsIncrementalDownload::OnStartRequest(nsIRequest *request,
}
// Adjust mChunkSize accordingly if mCurrentSize is close to mTotalSize.
nsInt64 diff = mTotalSize - mCurrentSize;
if (diff <= nsInt64(0)) {
PRInt64 diff = mTotalSize - mCurrentSize;
if (diff <= 0) {
NS_WARNING("about to set a bogus chunk size; giving up");
return NS_ERROR_UNEXPECTED;
}
if (diff < nsInt64(mChunkSize))
if (diff < mChunkSize)
mChunkSize = PRUint32(diff);
mChunk = new char[mChunkSize];

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

@ -49,8 +49,7 @@ nsInputStreamChannel::OpenContentStream(PRBool async, nsIInputStream **result,
// If content length is unknown, then we must guess. In this case, we assume
// the stream can tell us. If the stream is a pipe, then this will not work.
PRInt64 len = ContentLength64();
if (len < 0) {
if (ContentLength() < 0) {
PRUint32 avail;
nsresult rv = mContentStream->Available(&avail);
if (rv == NS_BASE_STREAM_CLOSED) {
@ -59,7 +58,7 @@ nsInputStreamChannel::OpenContentStream(PRBool async, nsIInputStream **result,
} else if (NS_FAILED(rv)) {
return rv;
}
SetContentLength64(avail);
ContentLength() = avail;
}
EnableSynthesizedProgressEvents(PR_TRUE);

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

@ -40,8 +40,7 @@
NS_HIDDEN_(nsNetStrings*) gNetStrings;
nsNetStrings::nsNetStrings()
: NS_LITERAL_STRING_INIT(kContentLength, NS_CHANNEL_PROP_CONTENT_LENGTH_STR),
NS_LITERAL_STRING_INIT(kContentDisposition, NS_CHANNEL_PROP_CONTENT_DISPOSITION_STR),
: NS_LITERAL_STRING_INIT(kContentDisposition, NS_CHANNEL_PROP_CONTENT_DISPOSITION_STR),
NS_LITERAL_STRING_INIT(kChannelPolicy, NS_CHANNEL_PROP_CHANNEL_POLICY_STR)
{}

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

@ -99,9 +99,15 @@ nsStreamLoader::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
{
nsCOMPtr<nsIChannel> chan( do_QueryInterface(request) );
if (chan) {
PRInt32 contentLength = -1;
PRInt64 contentLength = -1;
chan->GetContentLength(&contentLength);
if (contentLength >= 0) {
if (contentLength > PR_UINT32_MAX) {
// too big to fit in a PRUint32, bail now.
// XXX make mAllocated and mLength 64-bit
return NS_ERROR_OUT_OF_MEMORY;
}
// preallocate buffer
mData = static_cast<PRUint8*>(NS_Alloc(contentLength));
if (!mData) {

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

@ -121,7 +121,7 @@ nsDataChannel::OpenContentStream(PRBool async, nsIInputStream **result,
SetContentType(contentType);
SetContentCharset(contentCharset);
SetContentLength64(contentLen);
ContentLength() = contentLen;
NS_ADDREF(*result = bufInStream);

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

@ -357,7 +357,7 @@ nsFileChannel::OpenContentStream(PRBool async, nsIInputStream **result,
}
stream = uploadStream;
SetContentLength64(0);
ContentLength() = 0;
// Since there isn't any content to speak of we just set the content-type
// to something other than "unknown" to avoid triggering the content-type
@ -374,12 +374,12 @@ nsFileChannel::OpenContentStream(PRBool async, nsIInputStream **result,
EnableSynthesizedProgressEvents(PR_TRUE);
// fixup content length and type
if (ContentLength64() < 0) {
if (ContentLength() < 0) {
PRInt64 size;
rv = file->GetFileSize(&size);
if (NS_FAILED(rv))
return rv;
SetContentLength64(size);
ContentLength() = size;
}
if (!contentType.IsEmpty())
SetContentType(contentType);

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

@ -1007,7 +1007,7 @@ FTP_STATE
nsFtpState::R_size() {
if (mResponseCode/100 == 2) {
PR_sscanf(mResponseMsg.get() + 4, "%llu", &mFileSize);
mChannel->SetContentLength64(mFileSize);
mChannel->ContentLength() = mFileSize;
}
// We may want to be able to resume this

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

@ -359,20 +359,17 @@ HttpBaseChannel::SetContentCharset(const nsACString& aContentCharset)
}
NS_IMETHODIMP
HttpBaseChannel::GetContentLength(PRInt32 *aContentLength)
HttpBaseChannel::GetContentLength(PRInt64 *aContentLength)
{
NS_ENSURE_ARG_POINTER(aContentLength);
if (!mResponseHead)
return NS_ERROR_NOT_AVAILABLE;
// XXX truncates to 32 bit
*aContentLength = mResponseHead->ContentLength();
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::SetContentLength(PRInt32 value)
HttpBaseChannel::SetContentLength(PRInt64 value)
{
NS_NOTYETIMPLEMENTED("nsHttpChannel::SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -129,8 +129,8 @@ public:
NS_IMETHOD SetContentType(const nsACString& aContentType);
NS_IMETHOD GetContentCharset(nsACString& aContentCharset);
NS_IMETHOD SetContentCharset(const nsACString& aContentCharset);
NS_IMETHOD GetContentLength(PRInt32 *aContentLength);
NS_IMETHOD SetContentLength(PRInt32 aContentLength);
NS_IMETHOD GetContentLength(PRInt64 *aContentLength);
NS_IMETHOD SetContentLength(PRInt64 aContentLength);
NS_IMETHOD Open(nsIInputStream **aResult);
// HttpBaseChannel::nsIHttpChannel

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

@ -738,10 +738,6 @@ nsHttpChannel::CallOnStartRequest()
if (mResponseHead && mResponseHead->ContentCharset().IsEmpty())
mResponseHead->SetContentCharset(mContentCharsetHint);
if (mResponseHead)
SetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH,
mResponseHead->ContentLength());
// Allow consumers to override our content type
if ((mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) &&
gIOService->GetContentSniffers().Count() != 0) {
@ -2213,16 +2209,16 @@ nsHttpChannel::CheckCache()
// size of the cached content, then the cached response is partial...
// either we need to issue a byte range request or we need to refetch
// the entire document.
nsInt64 contentLength = mCachedResponseHead->ContentLength();
if (contentLength != nsInt64(-1)) {
PRInt64 contentLength = mCachedResponseHead->ContentLength();
if (contentLength != -1) {
PRUint32 size;
rv = mCacheEntry->GetDataSize(&size);
NS_ENSURE_SUCCESS(rv, rv);
if (nsInt64(size) != contentLength) {
if (PRInt64(size) != contentLength) {
LOG(("Cached data size does not match the Content-Length header "
"[content-length=%lld size=%u]\n", PRInt64(contentLength), size));
if ((nsInt64(size) < contentLength) && mCachedResponseHead->IsResumable()) {
"[content-length=%lld size=%u]\n", contentLength, size));
if ((PRInt64(size) < contentLength) && mCachedResponseHead->IsResumable()) {
// looks like a partial entry.
rv = SetupByteRangeRequest(size);
NS_ENSURE_SUCCESS(rv, rv);
@ -3825,7 +3821,7 @@ nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
// of a byte range request, the content length stored in the cached
// response headers is what we want to use here.
PRUint64 progressMax(PRUint64(mResponseHead->ContentLength()));
PRUint64 progressMax(mResponseHead->ContentLength());
PRUint64 progress = mLogicalOffset + PRUint64(count);
NS_ASSERTION(progress <= progressMax, "unexpected progress values");

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

@ -370,7 +370,7 @@ nsViewSourceChannel::SetContentCharset(const nsACString &aContentCharset)
}
NS_IMETHODIMP
nsViewSourceChannel::GetContentLength(PRInt32 *aContentLength)
nsViewSourceChannel::GetContentLength(PRInt64 *aContentLength)
{
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
@ -378,7 +378,7 @@ nsViewSourceChannel::GetContentLength(PRInt32 *aContentLength)
}
NS_IMETHODIMP
nsViewSourceChannel::SetContentLength(PRInt32 aContentLength)
nsViewSourceChannel::SetContentLength(PRInt64 aContentLength)
{
NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);

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

@ -37,7 +37,6 @@
#include "nsMultiMixedConv.h"
#include "nsMemory.h"
#include "nsInt64.h"
#include "plstr.h"
#include "nsIHttpChannel.h"
#include "nsIServiceManager.h"
@ -49,6 +48,7 @@
#include "nsIHttpChannelInternal.h"
#include "nsURLHelper.h"
#include "nsIStreamConverterService.h"
#include "prprf.h"
//
// Helper function for determining the length of data bytes up to
@ -324,14 +324,14 @@ nsPartChannel::SetContentCharset(const nsACString &aContentCharset)
}
NS_IMETHODIMP
nsPartChannel::GetContentLength(PRInt32 *aContentLength)
nsPartChannel::GetContentLength(PRInt64 *aContentLength)
{
*aContentLength = mContentLength; // XXX truncates 64-bit value
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP
nsPartChannel::SetContentLength(PRInt32 aContentLength)
nsPartChannel::SetContentLength(PRInt64 aContentLength)
{
mContentLength = aContentLength;
return NS_OK;
@ -797,7 +797,7 @@ nsMultiMixedConv::SendStart(nsIChannel *aChannel) {
rv = mPartChannel->SetContentType(mContentType);
if (NS_FAILED(rv)) return rv;
rv = mPartChannel->SetContentLength(mContentLength); // XXX Truncates 64-bit!
rv = mPartChannel->SetContentLength(mContentLength);
if (NS_FAILED(rv)) return rv;
rv = mPartChannel->SetContentDisposition(mContentDisposition);
@ -939,7 +939,7 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr,
if (headerStr.LowerCaseEqualsLiteral("content-type")) {
mContentType = headerVal;
} else if (headerStr.LowerCaseEqualsLiteral("content-length")) {
mContentLength = atoi(headerVal.get()); // XXX 64-bit math?
PR_sscanf(headerVal.get(), "%lld", &mContentLength);
} else if (headerStr.LowerCaseEqualsLiteral("content-disposition")) {
mContentDisposition = headerVal;
} else if (headerStr.LowerCaseEqualsLiteral("set-cookie")) {
@ -980,7 +980,7 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr,
mIsByteRangeRequest = PR_TRUE;
if (mContentLength == LL_MAXUINT)
mContentLength = PRUint64(PRInt64(mByteRangeEnd - mByteRangeStart + nsInt64(1)));
mContentLength = PRUint64(PRInt64(mByteRangeEnd - mByteRangeStart + 1));
}
}
*newLine = tmpChar;

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

@ -43,7 +43,6 @@
#include "nsString.h"
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "nsInt64.h"
#include "nsIByteRangeRequest.h"
#include "nsIMultiPartChannel.h"
#include "nsAutoPtr.h"
@ -102,8 +101,8 @@ protected:
PRUint64 mContentLength;
PRBool mIsByteRangeRequest;
nsInt64 mByteRangeStart;
nsInt64 mByteRangeEnd;
PRInt64 mByteRangeStart;
PRInt64 mByteRangeEnd;
PRUint32 mPartID; // unique ID that can be used to identify
// this part of the multipart document
@ -190,8 +189,8 @@ protected:
// The following members are for tracking the byte ranges in
// multipart/mixed content which specified the 'Content-Range:'
// header...
nsInt64 mByteRangeStart;
nsInt64 mByteRangeEnd;
PRInt64 mByteRangeStart;
PRInt64 mByteRangeEnd;
PRBool mIsByteRangeRequest;
PRUint32 mCurrentPartID;

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

@ -399,9 +399,9 @@ InputTestConsumer::OnStartRequest(nsIRequest *request, nsISupports* context)
channel->GetContentCharset(value);
LOG(("\tContent-Charset: %s\n", value.get()));
PRInt32 length = -1;
PRInt64 length = -1;
if (NS_SUCCEEDED(channel->GetContentLength(&length)))
LOG(("\tContent-Length: %d\n", length));
LOG(("\tContent-Length: %lld\n", length));
else
LOG(("\tContent-Length: Unknown\n"));
}
@ -424,15 +424,6 @@ InputTestConsumer::OnStartRequest(nsIRequest *request, nsISupports* context)
}
}
nsCOMPtr<nsIPropertyBag2> propbag = do_QueryInterface(request);
if (propbag) {
PRInt64 len;
nsresult rv = propbag->GetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH,
&len);
if (NS_SUCCEEDED(rv))
LOG(("\t64-bit length: %lli\n", len));
}
nsCOMPtr<nsIHttpChannelInternal> httpChannelInt(do_QueryInterface(request));
if (httpChannelInt) {
PRUint32 majorVer, minorVer;

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

@ -3151,7 +3151,7 @@ PSMContentDownloader::~PSMContentDownloader()
NS_IMPL_ISUPPORTS2(PSMContentDownloader, nsIStreamListener, nsIRequestObserver)
const PRInt32 kDefaultCertAllocLength = 2048;
const PRInt64 kDefaultCertAllocLength = 2048;
NS_IMETHODIMP
PSMContentDownloader::OnStartRequest(nsIRequest* request, nsISupports* context)
@ -3164,11 +3164,14 @@ PSMContentDownloader::OnStartRequest(nsIRequest* request, nsISupports* context)
// Get the URI //
channel->GetURI(getter_AddRefs(mURI));
PRInt32 contentLength;
PRInt64 contentLength;
rv = channel->GetContentLength(&contentLength);
if (NS_FAILED(rv) || contentLength <= 0)
contentLength = kDefaultCertAllocLength;
if (contentLength > PR_INT32_MAX)
return NS_ERROR_OUT_OF_MEMORY;
mBufferOffset = 0;
mBufferSize = 0;
mByteData = (char*) nsMemory::Alloc(contentLength);

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

@ -82,7 +82,6 @@ ExternalHelperAppParent::Init(TabParent *parent,
do_GetService(NS_EXTERNALHELPERAPPSERVICE_CONTRACTID);
NS_ASSERTION(helperAppService, "No Helper App Service!");
SetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH, mContentLength);
helperAppService->DoContent(aMimeContentType, this, ir,
aForceSave, getter_AddRefs(mListener));
}
@ -297,17 +296,14 @@ ExternalHelperAppParent::SetContentCharset(const nsACString& aContentCharset)
}
NS_IMETHODIMP
ExternalHelperAppParent::GetContentLength(PRInt32 *aContentLength)
ExternalHelperAppParent::GetContentLength(PRInt64 *aContentLength)
{
if (mContentLength > PR_INT32_MAX || mContentLength < 0)
*aContentLength = -1;
else
*aContentLength = (PRInt32)mContentLength;
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP
ExternalHelperAppParent::SetContentLength(PRInt32 aContentLength)
ExternalHelperAppParent::SetContentLength(PRInt64 aContentLength)
{
mContentLength = aContentLength;
return NS_OK;

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

@ -643,26 +643,6 @@ nsExternalHelperAppService::~nsExternalHelperAppService()
gExtProtSvc = nsnull;
}
static PRInt64 GetContentLengthAsInt64(nsIRequest *request)
{
PRInt64 contentLength = -1;
nsresult rv;
nsCOMPtr<nsIPropertyBag2> props(do_QueryInterface(request, &rv));
if (props)
rv = props->GetPropertyAsInt64(NS_CHANNEL_PROP_CONTENT_LENGTH, &contentLength);
if (NS_FAILED(rv)) {
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
if (channel) {
PRInt32 smallLen;
channel->GetContentLength(&smallLen);
contentLength = smallLen;
}
}
return contentLength;
}
NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeContentType,
nsIRequest *aRequest,
nsIInterfaceRequestor *aWindowContext,
@ -681,7 +661,6 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
channel->GetURI(getter_AddRefs(uri));
#ifdef MOZ_IPC
PRInt64 contentLength = GetContentLengthAsInt64(aRequest);
if (XRE_GetProcessType() == GeckoProcessType_Content) {
// We need to get a hold of a TabChild so that we can begin forwarding
// this data to the parent. In the HTTP case, this is unfortunate, since
@ -698,6 +677,10 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
if (!tabchild)
return NS_ERROR_FAILURE;
PRInt64 contentLength = -1;
if (channel)
channel->GetContentLength(&contentLength);
// Now we build a protocol for forwarding our data to the parent. The
// protocol will act as a listener on the child-side and create a "real"
// helperAppService listener on the parent-side, via another call to
@ -1417,7 +1400,7 @@ void nsExternalAppHandler::EnsureSuggestedFileName()
}
}
nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel * aChannel)
nsresult nsExternalAppHandler::SetUpTempFile()
{
// First we need to try to get the destination directory for the temporary
// file.
@ -1554,9 +1537,6 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest *request, nsISuppo
nsCOMPtr<nsIFileChannel> fileChan(do_QueryInterface(request));
mIsFileChannel = fileChan != nsnull;
// Get content length
mContentLength.mValue = GetContentLengthAsInt64(request);
nsCOMPtr<nsIPropertyBag2> props(do_QueryInterface(request, &rv));
// Determine whether a new window was opened specifically for this request
if (props) {
@ -1566,13 +1546,15 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest *request, nsISuppo
mShouldCloseWindow = tmp;
}
// Now get the URI
// Get content length and URI
mContentLength = -1;
if (aChannel)
{
aChannel->GetURI(getter_AddRefs(mSourceUrl));
aChannel->GetContentLength(&mContentLength);
}
rv = SetUpTempFile(aChannel);
rv = SetUpTempFile();
if (NS_FAILED(rv)) {
mCanceled = PR_TRUE;
request->Cancel(rv);

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

@ -49,8 +49,6 @@
#include "prlog.h"
#include "prtime.h"
#include "nsInt64.h"
#include "nsIExternalHelperAppService.h"
#include "nsIExternalProtocolService.h"
#include "nsIWebProgressListener2.h"
@ -342,8 +340,8 @@ protected:
PRBool mTempFileIsExecutable;
PRTime mTimeDownloadStarted;
nsInt64 mContentLength;
nsInt64 mProgress; /**< Number of bytes received (for sending progress notifications). */
PRInt64 mContentLength;
PRInt64 mProgress; /**< Number of bytes received (for sending progress notifications). */
/**
* When we are told to save the temp file to disk (in a more permament
@ -359,7 +357,7 @@ protected:
* Creates the temporary file for the download and an output stream for it.
* Upon successful return, both mTempFile and mOutStream will be valid.
*/
nsresult SetUpTempFile(nsIChannel * aChannel);
nsresult SetUpTempFile();
/**
* When we download a helper app, we are going to retarget all load
* notifications into our own docloader and load group instead of

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

@ -247,14 +247,14 @@ NS_IMETHODIMP nsExtProtocolChannel::SetContentCharset(const nsACString &aContent
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsExtProtocolChannel::GetContentLength(PRInt32 * aContentLength)
NS_IMETHODIMP nsExtProtocolChannel::GetContentLength(PRInt64 * aContentLength)
{
*aContentLength = -1;
return NS_OK;
}
NS_IMETHODIMP
nsExtProtocolChannel::SetContentLength(PRInt32 aContentLength)
nsExtProtocolChannel::SetContentLength(PRInt64 aContentLength)
{
NS_NOTREACHED("SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;

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

@ -574,7 +574,11 @@ NS_IMETHODIMP
nsOfflineCacheUpdateItem::GetTotalSize(PRInt32 *aTotalSize)
{
if (mChannel) {
return mChannel->GetContentLength(aTotalSize);
PRInt64 length;
mChannel->GetContentLength(&length);
*aTotalSize = PRInt32(length);
return NS_OK;
}
*aTotalSize = -1;
@ -584,7 +588,7 @@ nsOfflineCacheUpdateItem::GetTotalSize(PRInt32 *aTotalSize)
NS_IMETHODIMP
nsOfflineCacheUpdateItem::GetLoadedSize(PRInt32 *aLoadedSize)
{
*aLoadedSize = mBytesRead;
*aLoadedSize = PRInt32(mBytesRead);
return NS_OK;
}

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

@ -110,7 +110,7 @@ private:
PRUint16 mState;
protected:
PRInt32 mBytesRead;
PRInt64 mBytesRead;
};

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

@ -816,7 +816,11 @@ NS_IMETHODIMP
nsPrefetchNode::GetTotalSize(PRInt32 *aTotalSize)
{
if (mChannel) {
return mChannel->GetContentLength(aTotalSize);
PRInt64 length;
mChannel->GetContentLength(&length);
*aTotalSize = PRInt32(length);
return NS_OK;
}
*aTotalSize = -1;
@ -826,7 +830,7 @@ nsPrefetchNode::GetTotalSize(PRInt32 *aTotalSize)
NS_IMETHODIMP
nsPrefetchNode::GetLoadedSize(PRInt32 *aLoadedSize)
{
*aLoadedSize = mBytesRead;
*aLoadedSize = PRInt32(mBytesRead);
return NS_OK;
}

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

@ -146,7 +146,7 @@ private:
nsRefPtr<nsPrefetchService> mService;
nsCOMPtr<nsIChannel> mChannel;
PRUint16 mState;
PRInt32 mBytesRead;
PRInt64 mBytesRead;
};
#endif // !nsPrefetchService_h__

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

@ -290,14 +290,14 @@ STDMETHODIMP nsDataObj::CStream::Stat(STATSTG* statstg, DWORD dwFlags)
SystemTimeToFileTime((const SYSTEMTIME*)&st, (LPFILETIME)&statstg->mtime);
statstg->ctime = statstg->atime = statstg->mtime;
PRInt32 nLength = 0;
PRInt64 nLength = 0;
if (mChannel)
mChannel->GetContentLength(&nLength);
if (nLength < 0)
nLength = 0;
statstg->cbSize.LowPart = (DWORD)nLength;
statstg->cbSize.QuadPart = nLength;
statstg->grfMode = STGM_READ;
statstg->grfLocksSupported = LOCK_ONLYONCE;
statstg->clsid = CLSID_NULL;

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

@ -1279,8 +1279,7 @@ nsXPInstallManager::OnProgress(nsIRequest* request, nsISupports *ctxt, PRUint64
rv = channel->GetContentLength(&mContentLength);
if (NS_FAILED(rv)) return rv;
}
// XXX once channels support that, use 64-bit contentlength
rv = mDlg->OnProgress( mNextItem-1, aProgress, PRUint64(mContentLength) );
rv = mDlg->OnProgress( mNextItem-1, aProgress, mContentLength );
}
return rv;

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

@ -128,7 +128,7 @@ class nsXPInstallManager : public nsIXPIDialogService,
nsXPITriggerItem* mItem;
PRUint32 mNextItem;
PRUint32 mChromeType;
PRInt32 mContentLength;
PRInt64 mContentLength;
PRInt32 mOutstandingCertLoads;
PRBool mDialogOpen;
PRBool mCancelled;