mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 460751 - Progress events should use long long, not long for .total and .loaded, r=chris.double, sr=sicking
This commit is contained in:
parent
0330be9daf
commit
3fa3e7fa87
@ -2583,7 +2583,9 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
|
||||
}
|
||||
|
||||
mUploadComplete = PR_FALSE;
|
||||
postDataStream->Available(&mUploadTotal);
|
||||
PRUint32 uploadTotal = 0;
|
||||
postDataStream->Available(&uploadTotal);
|
||||
mUploadTotal = uploadTotal;
|
||||
rv = uploadChannel->SetUploadStream(postDataStream, contentType, -1);
|
||||
// Reset the method to its original value
|
||||
if (httpChannel) {
|
||||
@ -3152,7 +3154,7 @@ nsXMLHttpRequest::OnProgress(nsIRequest *aRequest, nsISupports *aContext, PRUint
|
||||
PRBool lengthComputable = (aProgressMax != LL_MAXUINT);
|
||||
if (upload) {
|
||||
if (lengthComputable) {
|
||||
PRUint32 headerSize = aProgressMax - mUploadTotal;
|
||||
PRUint64 headerSize = aProgressMax - mUploadTotal;
|
||||
loaded -= headerSize;
|
||||
total -= headerSize;
|
||||
}
|
||||
@ -3179,7 +3181,7 @@ nsXMLHttpRequest::OnProgress(nsIRequest *aRequest, nsISupports *aContext, PRUint
|
||||
aProgress, aProgressMax);
|
||||
|
||||
if (upload && mUpload && !mUploadComplete) {
|
||||
NS_WARN_IF_FALSE(mUploadTotal == PRUint32(total), "Wrong upload total?");
|
||||
NS_WARN_IF_FALSE(mUploadTotal == total, "Wrong upload total?");
|
||||
DispatchProgressEvent(mUpload, progress, PR_TRUE, lengthComputable, loaded,
|
||||
lengthComputable ? total : 0, aProgress, aProgressMax);
|
||||
}
|
||||
|
@ -449,8 +449,8 @@ protected:
|
||||
PRUint32 mState;
|
||||
|
||||
nsRefPtr<nsXMLHttpRequestUpload> mUpload;
|
||||
PRUint32 mUploadTransferred;
|
||||
PRUint32 mUploadTotal;
|
||||
PRUint64 mUploadTransferred;
|
||||
PRUint64 mUploadTotal;
|
||||
PRPackedBool mUploadComplete;
|
||||
PRUint64 mUploadProgress; // For legacy
|
||||
PRUint64 mUploadProgressMax; // For legacy
|
||||
|
@ -56,14 +56,14 @@ nsDOMProgressEvent::GetLengthComputable(PRBool* aLengthComputable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMProgressEvent::GetLoaded(PRUint32* aLoaded)
|
||||
nsDOMProgressEvent::GetLoaded(PRUint64* aLoaded)
|
||||
{
|
||||
*aLoaded = mLoaded;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMProgressEvent::GetTotal(PRUint32* aTotal)
|
||||
nsDOMProgressEvent::GetTotal(PRUint64* aTotal)
|
||||
{
|
||||
*aTotal = mTotal;
|
||||
return NS_OK;
|
||||
@ -74,8 +74,8 @@ nsDOMProgressEvent::InitProgressEvent(const nsAString& aType,
|
||||
PRBool aCanBubble,
|
||||
PRBool aCancelable,
|
||||
PRBool aLengthComputable,
|
||||
PRUint32 aLoaded,
|
||||
PRUint32 aTotal)
|
||||
PRUint64 aLoaded,
|
||||
PRUint64 aTotal)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -66,8 +66,8 @@ public:
|
||||
|
||||
private:
|
||||
PRBool mLengthComputable;
|
||||
PRUint32 mLoaded;
|
||||
PRUint32 mTotal;
|
||||
PRUint64 mLoaded;
|
||||
PRUint64 mTotal;
|
||||
};
|
||||
|
||||
#endif // nsDOMProgressEvent_h__
|
||||
|
@ -130,7 +130,7 @@ class nsMediaDecoder : public nsIObserver
|
||||
|
||||
// Return the current number of bytes loaded from the video file.
|
||||
// This is used for progress events.
|
||||
virtual PRUint32 GetBytesLoaded() = 0;
|
||||
virtual PRUint64 GetBytesLoaded() = 0;
|
||||
|
||||
// Return the size of the video file in bytes. Return 0 if the
|
||||
// size is unknown or the stream is infinite.
|
||||
@ -152,7 +152,7 @@ class nsMediaDecoder : public nsIObserver
|
||||
virtual void Progress();
|
||||
|
||||
// Keep track of the number of bytes downloaded
|
||||
virtual void UpdateBytesDownloaded(PRUint32 aBytes) = 0;
|
||||
virtual void UpdateBytesDownloaded(PRUint64 aBytes) = 0;
|
||||
|
||||
// Cleanup internal data structures. Must be called on the main
|
||||
// thread by the owning object before that object disposes of this object.
|
||||
|
@ -326,7 +326,7 @@ class nsOggDecoder : public nsMediaDecoder
|
||||
void GetCurrentURI(nsIURI** aURI);
|
||||
nsIPrincipal* GetCurrentPrincipal();
|
||||
|
||||
virtual void UpdateBytesDownloaded(PRUint32 aBytes);
|
||||
virtual void UpdateBytesDownloaded(PRUint64 aBytes);
|
||||
|
||||
// Called when the video file has completed downloading.
|
||||
// Call on the main thread only.
|
||||
@ -378,7 +378,7 @@ protected:
|
||||
|
||||
// Return the current number of bytes loaded from the video file.
|
||||
// This is used for progress events.
|
||||
virtual PRUint32 GetBytesLoaded();
|
||||
virtual PRUint64 GetBytesLoaded();
|
||||
|
||||
// Return the size of the video file in bytes.
|
||||
// This is used for progress events.
|
||||
@ -411,7 +411,7 @@ private:
|
||||
* The following members should be accessed on the main thread only
|
||||
******/
|
||||
// Total number of bytes downloaded so far.
|
||||
PRUint32 mBytesDownloaded;
|
||||
PRUint64 mBytesDownloaded;
|
||||
|
||||
// The URI of the current resource
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
@ -1315,7 +1315,7 @@ NS_IMETHODIMP nsOggDecoder::Observe(nsISupports *aSubjet,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 nsOggDecoder::GetBytesLoaded()
|
||||
PRUint64 nsOggDecoder::GetBytesLoaded()
|
||||
{
|
||||
return mBytesDownloaded;
|
||||
}
|
||||
@ -1330,7 +1330,7 @@ void nsOggDecoder::SetTotalBytes(PRInt64 aBytes)
|
||||
mContentLength = aBytes;
|
||||
}
|
||||
|
||||
void nsOggDecoder::UpdateBytesDownloaded(PRUint32 aBytes)
|
||||
void nsOggDecoder::UpdateBytesDownloaded(PRUint64 aBytes)
|
||||
{
|
||||
mBytesDownloaded = aBytes;
|
||||
}
|
||||
|
@ -45,16 +45,16 @@
|
||||
* the specification is complete and is compatible with the WebKit ProgressEvent.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(3fa16b05-81a0-4a17-ab06-98c3a5a5be09)]
|
||||
[scriptable, uuid(6af7022c-d7f8-414c-a11f-a7918f14052b)]
|
||||
interface nsIDOMProgressEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute boolean lengthComputable;
|
||||
readonly attribute unsigned long loaded;
|
||||
readonly attribute unsigned long total;
|
||||
readonly attribute unsigned long long loaded;
|
||||
readonly attribute unsigned long long total;
|
||||
void initProgressEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in boolean lengthComputableArg,
|
||||
in unsigned long loadedArg,
|
||||
in unsigned long totalArg);
|
||||
in unsigned long long loadedArg,
|
||||
in unsigned long long totalArg);
|
||||
};
|
||||
|
@ -199,8 +199,8 @@ protected:
|
||||
nsCString mStatusText;
|
||||
nsresult mStatus;
|
||||
PRInt32 mReadyState;
|
||||
PRUint32 mLoaded;
|
||||
PRUint32 mTotal;
|
||||
PRUint64 mLoaded;
|
||||
PRUint64 mTotal;
|
||||
PRInt32 mChannelID;
|
||||
PRPackedBool mBubbles;
|
||||
PRPackedBool mCancelable;
|
||||
@ -453,7 +453,7 @@ nsDOMWorkerXHREvent::GetLengthComputable(PRBool* aLengthComputable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWorkerXHREvent::GetLoaded(PRUint32* aLoaded)
|
||||
nsDOMWorkerXHREvent::GetLoaded(PRUint64* aLoaded)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLoaded);
|
||||
*aLoaded = mLoaded;
|
||||
@ -461,7 +461,7 @@ nsDOMWorkerXHREvent::GetLoaded(PRUint32* aLoaded)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWorkerXHREvent::GetTotal(PRUint32* aTotal)
|
||||
nsDOMWorkerXHREvent::GetTotal(PRUint64* aTotal)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTotal);
|
||||
*aTotal = mTotal;
|
||||
@ -473,8 +473,8 @@ nsDOMWorkerXHREvent::InitProgressEvent(const nsAString_internal& aTypeArg,
|
||||
PRBool aCanBubbleArg,
|
||||
PRBool aCancelableArg,
|
||||
PRBool aLengthComputableArg,
|
||||
PRUint32 aLoadedArg,
|
||||
PRUint32 aTotalArg)
|
||||
PRUint64 aLoadedArg,
|
||||
PRUint64 aTotalArg)
|
||||
{
|
||||
NS_WARNING("InitProgressEvent doesn't do anything here!");
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user