Bug 784912 - nsIStreamListener.onDataAvailable should handle 64-bit offset. r=honza
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 06 Sep 2012 11:41:02 +0900
changeset 104387 5d63594c05a9fa801fbbbc8adb38946d8fb77970
parent 104386 501f4e46a88c329994803b1d8d49174c69a37db2
child 104388 ff19aab9d56c1c8fad79592543be65116c65ae4a
child 104437 5f8055d8dde1cda9ed9672e3ac0974faa4042855
push id14486
push userryanvm@gmail.com
push dateThu, 06 Sep 2012 03:03:12 +0000
treeherdermozilla-inbound@ff19aab9d56c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonza
bugs784912
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 784912 - nsIStreamListener.onDataAvailable should handle 64-bit offset. r=honza
browser/components/feeds/src/nsFeedSniffer.cpp
content/base/src/FileIOObject.cpp
content/base/src/FileIOObject.h
content/base/src/nsCrossSiteListenerProxy.cpp
content/base/src/nsDOMFileReader.cpp
content/base/src/nsDOMFileReader.h
content/base/src/nsDocument.cpp
content/base/src/nsEventSource.cpp
content/base/src/nsObjectLoadingContent.cpp
content/base/src/nsXMLHttpRequest.cpp
content/html/content/src/nsHTMLMediaElement.cpp
content/html/document/src/MediaDocument.cpp
content/media/MediaResource.cpp
content/xbl/src/nsXBLService.cpp
content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp
content/xul/document/src/nsXULDocument.cpp
docshell/base/nsDocShell.cpp
dom/plugins/base/nsPluginStreamListenerPeer.cpp
dom/src/json/nsJSON.cpp
dom/src/jsurl/nsJSProtocolHandler.cpp
embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
extensions/pref/autoconfig/src/nsAutoConfig.cpp
image/decoders/icon/mac/nsIconChannelCocoa.mm
image/decoders/icon/os2/nsIconChannel.cpp
image/decoders/icon/win/nsIconChannel.cpp
image/src/SVGDocumentWrapper.cpp
image/src/VectorImage.cpp
image/src/imgLoader.cpp
image/src/imgRequest.cpp
modules/libjar/nsJARChannel.cpp
modules/libjar/zipwriter/src/nsDeflateConverter.cpp
modules/libjar/zipwriter/src/nsDeflateConverter.h
modules/libjar/zipwriter/src/nsZipDataStream.cpp
modules/libjar/zipwriter/src/nsZipDataStream.h
netwerk/base/public/nsIStreamListener.idl
netwerk/base/src/nsBaseChannel.cpp
netwerk/base/src/nsDownloader.cpp
netwerk/base/src/nsIncrementalDownload.cpp
netwerk/base/src/nsInputStreamPump.cpp
netwerk/base/src/nsSimpleStreamListener.cpp
netwerk/base/src/nsStreamListenerTee.cpp
netwerk/base/src/nsStreamLoader.cpp
netwerk/base/src/nsSyncStreamListener.cpp
netwerk/base/src/nsURIChecker.cpp
netwerk/base/src/nsUnicharStreamLoader.cpp
netwerk/protocol/ftp/FTPChannelChild.cpp
netwerk/protocol/ftp/FTPChannelChild.h
netwerk/protocol/ftp/FTPChannelParent.cpp
netwerk/protocol/ftp/PFTPChannel.ipdl
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelChild.h
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParentListener.cpp
netwerk/protocol/http/PHttpChannel.ipdl
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/viewsource/nsViewSourceChannel.cpp
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/protocol/wyciwyg/PWyciwygChannel.ipdl
netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
netwerk/protocol/wyciwyg/WyciwygChannelChild.h
netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
netwerk/streamconv/converters/nsBinHexDecoder.cpp
netwerk/streamconv/converters/nsDirIndexParser.cpp
netwerk/streamconv/converters/nsFTPDirListingConv.cpp
netwerk/streamconv/converters/nsHTTPCompressConv.cpp
netwerk/streamconv/converters/nsHTTPCompressConv.h
netwerk/streamconv/converters/nsIndexedToHTML.cpp
netwerk/streamconv/converters/nsMultiMixedConv.cpp
netwerk/streamconv/converters/nsMultiMixedConv.h
netwerk/streamconv/converters/nsTXTToHTMLConv.cpp
netwerk/streamconv/converters/nsUnknownDecoder.cpp
netwerk/streamconv/test/Converters.cpp
netwerk/streamconv/test/TestStreamConv.cpp
netwerk/test/TestCallbacks.cpp
netwerk/test/TestHttp.cpp
netwerk/test/TestMCTransport.cpp
netwerk/test/TestOverlappedIO.cpp
netwerk/test/TestPageLoad.cpp
netwerk/test/TestPerf.cpp
netwerk/test/TestProtocols.cpp
netwerk/test/TestRes.cpp
netwerk/test/TestSocketInput.cpp
netwerk/test/TestStreamPump.cpp
netwerk/test/TestThreadedIO.cpp
netwerk/test/TestUpload.cpp
parser/html/nsHtml5StreamParser.cpp
parser/htmlparser/src/nsParser.cpp
parser/xml/src/nsSAXXMLReader.cpp
rdf/base/src/nsRDFXMLDataSource.cpp
security/manager/ssl/src/nsNSSComponent.cpp
toolkit/components/places/AsyncFaviconHelpers.cpp
toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
uriloader/base/nsURILoader.cpp
uriloader/exthandler/ExternalHelperAppChild.cpp
uriloader/exthandler/ExternalHelperAppParent.cpp
uriloader/exthandler/ExternalHelperAppParent.h
uriloader/exthandler/PExternalHelperApp.ipdl
uriloader/exthandler/nsExternalHelperAppService.cpp
uriloader/prefetch/nsOfflineCacheUpdate.cpp
uriloader/prefetch/nsPrefetchService.cpp
widget/windows/nsDataObj.cpp
xpfe/components/directory/nsDirectoryViewer.cpp
--- a/browser/components/feeds/src/nsFeedSniffer.cpp
+++ b/browser/components/feeds/src/nsFeedSniffer.cpp
@@ -341,17 +341,17 @@ nsFeedSniffer::AppendSegmentToString(nsI
   nsCString* decodedData = static_cast<nsCString*>(closure);
   decodedData->Append(rawSegment, count);
   *writeCount = count;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFeedSniffer::OnDataAvailable(nsIRequest* request, nsISupports* context,
-                               nsIInputStream* stream, uint32_t offset, 
+                               nsIInputStream* stream, uint64_t offset, 
                                uint32_t count)
 {
   uint32_t read;
   return stream->ReadSegments(AppendSegmentToString, &mDecodedData, count, 
                               &read);
 }
 
 NS_IMETHODIMP
--- a/content/base/src/FileIOObject.cpp
+++ b/content/base/src/FileIOObject.cpp
@@ -160,17 +160,17 @@ FileIOObject::DoOnStartRequest(nsIReques
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 FileIOObject::OnDataAvailable(nsIRequest *aRequest,
                               nsISupports *aContext,
                               nsIInputStream *aInputStream,
-                              uint32_t aOffset,
+                              uint64_t aOffset,
                               uint32_t aCount)
 {
   nsresult rv;
   rv = DoOnDataAvailable(aRequest, aContext, aInputStream, aOffset, aCount);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mTransferred += aCount;
 
--- a/content/base/src/FileIOObject.h
+++ b/content/base/src/FileIOObject.h
@@ -63,17 +63,17 @@ protected:
   // special handling
   NS_IMETHOD DoOnStartRequest(nsIRequest *aRequest, nsISupports *aContext);
   // for onStopRequest
   NS_IMETHOD DoOnStopRequest(nsIRequest *aRequest, nsISupports *aContext,
                              nsresult aStatus, nsAString& aSuccessEvent,
                              nsAString& aTerminationEvent) = 0;
   // and for onDataAvailable
   NS_IMETHOD DoOnDataAvailable(nsIRequest *aRequest, nsISupports *aContext,
-                               nsIInputStream *aInputStream, uint32_t aOffset,
+                               nsIInputStream *aInputStream, uint64_t aOffset,
                                uint32_t aCount) = 0;
 
   void StartProgressEventTimer();
   void ClearProgressEventTimer();
   void DispatchError(nsresult rv, nsAString& finalEvent);
   nsresult DispatchProgressEvent(const nsAString& aType);
 
   nsCOMPtr<nsITimer> mProgressNotifier;
--- a/content/base/src/nsCrossSiteListenerProxy.cpp
+++ b/content/base/src/nsCrossSiteListenerProxy.cpp
@@ -609,17 +609,17 @@ nsCORSListenerProxy::OnStopRequest(nsIRe
   mNewRedirectChannel = nullptr;
   return rv;
 }
 
 NS_IMETHODIMP
 nsCORSListenerProxy::OnDataAvailable(nsIRequest* aRequest,
                                      nsISupports* aContext, 
                                      nsIInputStream* aInputStream,
-                                     uint32_t aOffset,
+                                     uint64_t aOffset,
                                      uint32_t aCount)
 {
   if (!mRequestApproved) {
     return NS_ERROR_DOM_BAD_URI;
   }
   return mOuterListener->OnDataAvailable(aRequest, aContext, aInputStream,
                                          aOffset, aCount);
 }
@@ -1001,17 +1001,17 @@ nsCORSPreflightListener::OnStopRequest(n
 }
 
 /** nsIStreamListener methods **/
 
 NS_IMETHODIMP
 nsCORSPreflightListener::OnDataAvailable(nsIRequest *aRequest,
                                          nsISupports *ctxt,
                                          nsIInputStream *inStr,
-                                         uint32_t sourceOffset,
+                                         uint64_t sourceOffset,
                                          uint32_t count)
 {
   uint32_t totalRead;
   return inStr->ReadSegments(NS_DiscardSegment, nullptr, count, &totalRead);
 }
 
 NS_IMETHODIMP
 nsCORSPreflightListener::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
--- a/content/base/src/nsDOMFileReader.cpp
+++ b/content/base/src/nsDOMFileReader.cpp
@@ -281,24 +281,27 @@ ReadFuncBinaryString(nsIInputStream* in,
 
   return NS_OK;
 }
 
 nsresult
 nsDOMFileReader::DoOnDataAvailable(nsIRequest *aRequest,
                                    nsISupports *aContext,
                                    nsIInputStream *aInputStream,
-                                   uint32_t aOffset,
+                                   uint64_t aOffset,
                                    uint32_t aCount)
 {
   if (mDataFormat == FILE_AS_BINARY) {
     //Continuously update our binary string as data comes in
     NS_ASSERTION(mResult.Length() == aOffset,
                  "unexpected mResult length");
     uint32_t oldLen = mResult.Length();
+    if (uint64_t(oldLen) + aCount > PR_UINT32_MAX)
+      return NS_ERROR_OUT_OF_MEMORY;
+
     PRUnichar *buf = nullptr;
     mResult.GetMutableData(&buf, oldLen + aCount, fallible_t());
     NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY);
 
     uint32_t bytesRead = 0;
     aInputStream->ReadSegments(ReadFuncBinaryString, buf + oldLen, aCount,
                                &bytesRead);
     NS_ASSERTION(bytesRead == aCount, "failed to read data");
@@ -306,16 +309,20 @@ nsDOMFileReader::DoOnDataAvailable(nsIRe
   else if (mDataFormat == FILE_AS_ARRAYBUFFER) {
     uint32_t bytesRead = 0;
     aInputStream->Read((char*)JS_GetArrayBufferData(mResultArrayBuffer, NULL) + aOffset,
                        aCount, &bytesRead);
     NS_ASSERTION(bytesRead == aCount, "failed to read data");
   }
   else {
     //Update memory buffer to reflect the contents of the file
+    if (aOffset + aCount > PR_UINT32_MAX) {
+      // PR_Realloc doesn't support over 4GB memory size even if 64-bit OS
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
     mFileData = (char *)PR_Realloc(mFileData, aOffset + aCount);
     NS_ENSURE_TRUE(mFileData, NS_ERROR_OUT_OF_MEMORY);
 
     uint32_t bytesRead = 0;
     aInputStream->Read(mFileData + aOffset, aCount, &bytesRead);
     NS_ASSERTION(bytesRead == aCount, "failed to read data");
 
     mDataLen += aCount;
--- a/content/base/src/nsDOMFileReader.h
+++ b/content/base/src/nsDOMFileReader.h
@@ -52,17 +52,17 @@ public:
                         uint32_t argc, jsval* argv);
 
   // FileIOObject overrides
   NS_IMETHOD DoAbort(nsAString& aEvent);
   NS_IMETHOD DoOnStopRequest(nsIRequest* aRequest, nsISupports* aContext,
                              nsresult aStatus, nsAString& aSuccessEvent,
                              nsAString& aTerminationEvent);
   NS_IMETHOD DoOnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
-                               nsIInputStream* aInputStream, uint32_t aOffset,
+                               nsIInputStream* aInputStream, uint64_t aOffset,
                                uint32_t aCount);
 
   nsresult Init();
 
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsDOMFileReader,
                                                          FileIOObject)
   void RootResultArrayBuffer();
 
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -1018,17 +1018,17 @@ nsExternalResourceMap::PendingLoad::Setu
   newLoadGroup.forget(aLoadGroup);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsExternalResourceMap::PendingLoad::OnDataAvailable(nsIRequest* aRequest,
                                                     nsISupports* aContext,
                                                     nsIInputStream* aStream,
-                                                    uint32_t aOffset,
+                                                    uint64_t aOffset,
                                                     uint32_t aCount)
 {
   NS_PRECONDITION(mTargetListener, "Shouldn't be getting called!");
   if (mDisplayDocument->ExternalResourceMap().HaveShutDown()) {
     return NS_BINDING_ABORTED;
   }
   return mTargetListener->OnDataAvailable(aRequest, aContext, aStream, aOffset,
                                           aCount);
--- a/content/base/src/nsEventSource.cpp
+++ b/content/base/src/nsEventSource.cpp
@@ -532,17 +532,17 @@ nsEventSource::StreamReaderFunc(nsIInput
   *aWriteCount = aCount;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsEventSource::OnDataAvailable(nsIRequest *aRequest,
                                nsISupports *aContext,
                                nsIInputStream *aInputStream,
-                               uint32_t aOffset,
+                               uint64_t aOffset,
                                uint32_t aCount)
 {
   NS_ENSURE_ARG_POINTER(aInputStream);
 
   nsresult rv = CheckHealthOfRequestCallback(aRequest);
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint32_t totalRead;
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -870,17 +870,17 @@ nsObjectLoadingContent::OnStopRequest(ns
 }
 
 
 // nsIStreamListener
 NS_IMETHODIMP
 nsObjectLoadingContent::OnDataAvailable(nsIRequest *aRequest,
                                         nsISupports *aContext,
                                         nsIInputStream *aInputStream,
-                                        uint32_t aOffset, uint32_t aCount)
+                                        uint64_t aOffset, uint32_t aCount)
 {
   NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
 
   if (aRequest != mChannel) {
     return NS_BINDING_ABORTED;
   }
 
   if (mFinalListener) {
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -269,17 +269,17 @@ nsMultipartProxyListener::OnStopRequest(
 }
 
 /** nsIStreamListener methods **/
 
 NS_IMETHODIMP
 nsMultipartProxyListener::OnDataAvailable(nsIRequest *aRequest,
                                           nsISupports *ctxt,
                                           nsIInputStream *inStr,
-                                          uint32_t sourceOffset,
+                                          uint64_t sourceOffset,
                                           uint32_t count)
 {
   return mDestListener->OnDataAvailable(aRequest, ctxt, inStr, sourceOffset,
                                         count);
 }
 
 /////////////////////////////////////////////
 
@@ -1920,17 +1920,17 @@ bool nsXMLHttpRequest::CreateDOMFile(nsI
   }
   return fromFile;
 }
 
 NS_IMETHODIMP
 nsXMLHttpRequest::OnDataAvailable(nsIRequest *request,
                                   nsISupports *ctxt,
                                   nsIInputStream *inStr,
-                                  uint32_t sourceOffset,
+                                  uint64_t sourceOffset,
                                   uint32_t count)
 {
   NS_ENSURE_ARG_POINTER(inStr);
 
   NS_ABORT_IF_FALSE(mContext.get() == ctxt,"start context different from OnDataAvailable context");
 
   mProgressSinceLastProgressEvent = true;
 
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -353,19 +353,22 @@ NS_IMETHODIMP nsHTMLMediaElement::MediaL
                                                                    nsresult aStatus)
 {
   if (mNextListener) {
     return mNextListener->OnStopRequest(aRequest, aContext, aStatus);
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
-                                                                     nsIInputStream* aStream, uint32_t aOffset,
-                                                                     uint32_t aCount)
+NS_IMETHODIMP
+nsHTMLMediaElement::MediaLoadListener::OnDataAvailable(nsIRequest* aRequest,
+                                                       nsISupports* aContext,
+                                                       nsIInputStream* aStream,
+                                                       uint64_t aOffset,
+                                                       uint32_t aCount)
 {
   if (!mNextListener) {
     NS_ERROR("Must have a chained listener; OnStartRequest should have canceled this request");
     return NS_BINDING_ABORTED;
   }
   return mNextListener->OnDataAvailable(aRequest, aContext, aStream, aOffset, aCount);
 }
 
--- a/content/html/document/src/MediaDocument.cpp
+++ b/content/html/document/src/MediaDocument.cpp
@@ -72,17 +72,17 @@ MediaDocumentStreamListener::OnStopReque
 
   return rv;
 }
 
 NS_IMETHODIMP
 MediaDocumentStreamListener::OnDataAvailable(nsIRequest* request,
                                              nsISupports *ctxt,
                                              nsIInputStream *inStr,
-                                             uint32_t sourceOffset,
+                                             uint64_t sourceOffset,
                                              uint32_t count)
 {
   if (mNextStream) {
     return mNextStream->OnDataAvailable(request, ctxt, inStr, sourceOffset, count);
   }
 
   return NS_OK;
 }
--- a/content/media/MediaResource.cpp
+++ b/content/media/MediaResource.cpp
@@ -82,17 +82,17 @@ ChannelMediaResource::Listener::OnStopRe
     return NS_OK;
   return mResource->OnStopRequest(aRequest, aStatus);
 }
 
 nsresult
 ChannelMediaResource::Listener::OnDataAvailable(nsIRequest* aRequest,
                                                 nsISupports* aContext,
                                                 nsIInputStream* aStream,
-                                                uint32_t aOffset,
+                                                uint64_t aOffset,
                                                 uint32_t aCount)
 {
   if (!mResource)
     return NS_OK;
   return mResource->OnDataAvailable(aRequest, aStream, aCount);
 }
 
 nsresult
--- a/content/xbl/src/nsXBLService.cpp
+++ b/content/xbl/src/nsXBLService.cpp
@@ -228,18 +228,19 @@ nsXBLStreamListener::~nsXBLStreamListene
 {
   for (uint32_t i = 0; i < mBindingRequests.Length(); i++) {
     nsXBLBindingRequest* req = mBindingRequests.ElementAt(i);
     nsXBLBindingRequest::Destroy(nsXBLService::GetInstance()->mPool, req);
   }
 }
 
 NS_IMETHODIMP
-nsXBLStreamListener::OnDataAvailable(nsIRequest *request, nsISupports* aCtxt, nsIInputStream* aInStr, 
-                                     uint32_t aSourceOffset, uint32_t aCount)
+nsXBLStreamListener::OnDataAvailable(nsIRequest *request, nsISupports* aCtxt,
+                                     nsIInputStream* aInStr, 
+                                     uint64_t aSourceOffset, uint32_t aCount)
 {
   if (mInner)
     return mInner->OnDataAvailable(request, aCtxt, aInStr, aSourceOffset, aCount);
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsXBLStreamListener::OnStartRequest(nsIRequest* request, nsISupports* aCtxt)
--- a/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp
+++ b/content/xslt/src/xslt/txMozillaStylesheetCompiler.cpp
@@ -218,17 +218,17 @@ NS_IMETHODIMP
 txStylesheetSink::DidBuildModel(bool aTerminated)
 {  
     return mCompiler->doneLoading();
 }
 
 NS_IMETHODIMP
 txStylesheetSink::OnDataAvailable(nsIRequest *aRequest, nsISupports *aContext,
                                   nsIInputStream *aInputStream,
-                                  uint32_t aOffset, uint32_t aCount)
+                                  uint64_t aOffset, uint32_t aCount)
 {
     if (!mCheckedForXML) {
         nsCOMPtr<nsIParser> parser = do_QueryInterface(aContext);
         nsCOMPtr<nsIDTD> dtd;
         parser->GetDTD(getter_AddRefs(dtd));
         if (dtd) {
             mCheckedForXML = true;
             if (!(dtd->GetType() & NS_IPARSER_FLAG_XML)) {
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -4495,17 +4495,17 @@ nsXULDocument::CachedChromeStreamListene
     return mDocument->OnPrototypeLoadDone(true);
 }
 
 
 NS_IMETHODIMP
 nsXULDocument::CachedChromeStreamListener::OnDataAvailable(nsIRequest *request,
                                                            nsISupports* aContext,
                                                            nsIInputStream* aInStr,
-                                                           uint32_t aSourceOffset,
+                                                           uint64_t aSourceOffset,
                                                            uint32_t aCount)
 {
     NS_NOTREACHED("CachedChromeStream doesn't receive data");
     return NS_ERROR_UNEXPECTED;
 }
 
 //----------------------------------------------------------------------
 //
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -434,17 +434,17 @@ NS_IMPL_ISUPPORTS4(nsPingListener, nsISt
 NS_IMETHODIMP
 nsPingListener::OnStartRequest(nsIRequest *request, nsISupports *context)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPingListener::OnDataAvailable(nsIRequest *request, nsISupports *context,
-                                nsIInputStream *stream, uint32_t offset,
+                                nsIInputStream *stream, uint64_t offset,
                                 uint32_t count)
 {
   uint32_t result;
   return stream->ReadSegments(NS_DiscardSegment, nullptr, count, &result);
 }
 
 NS_IMETHODIMP
 nsPingListener::OnStopRequest(nsIRequest *request, nsISupports *context,
--- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp
+++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp
@@ -213,17 +213,19 @@ CachedFileHolder::Release()
   NS_LOG_RELEASE(this, mRefCnt, "CachedFileHolder");
   if (0 == mRefCnt)
     delete this;
 }
 
 
 NS_IMETHODIMP
 nsPluginByteRangeStreamListener::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
-                                                 nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count)
+                                                 nsIInputStream *inStr,
+                                                 uint64_t sourceOffset,
+                                                 uint32_t count)
 {
   if (!mStreamConverter)
     return NS_ERROR_FAILURE;
   
   nsCOMPtr<nsIStreamListener> finalStreamListener = do_QueryReferent(mWeakPtrPluginStreamListenerPeer);
   if (!finalStreamListener)
     return NS_ERROR_FAILURE;
   
@@ -844,17 +846,17 @@ nsPluginStreamListenerPeer::UseExistingP
     return true;
   }
   return false;
 }
 
 NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIRequest *request,
                                                           nsISupports* aContext,
                                                           nsIInputStream *aIStream,
-                                                          uint32_t sourceOffset,
+                                                          uint64_t sourceOffset,
                                                           uint32_t aLength)
 {
   NS_ASSERTION(mRequests.IndexOfObject(GetBaseRequest(request)) != -1,
                "Received OnDataAvailable for untracked request.");
   
   if (mRequestFailed)
     return NS_ERROR_FAILURE;
   
@@ -875,17 +877,17 @@ NS_IMETHODIMP nsPluginStreamListenerPeer
   
   if (!mPStreamListener)
     return NS_ERROR_FAILURE;
   
   const char * url = nullptr;
   GetURL(&url);
   
   PLUGIN_LOG(PLUGIN_LOG_NOISY,
-             ("nsPluginStreamListenerPeer::OnDataAvailable this=%p request=%p, offset=%d, length=%d, url=%s\n",
+             ("nsPluginStreamListenerPeer::OnDataAvailable this=%p request=%p, offset=%llu, length=%u, url=%s\n",
               this, request, sourceOffset, aLength, url ? url : "no url set"));
   
   // if the plugin has requested an AsFileOnly stream, then don't
   // call OnDataAvailable
   if (mStreamType != NP_ASFILEONLY) {
     // get the absolute offset of the request, if one exists.
     nsCOMPtr<nsIByteRangeRequest> brr = do_QueryInterface(request);
     if (brr) {
--- a/dom/src/json/nsJSON.cpp
+++ b/dom/src/json/nsJSON.cpp
@@ -450,17 +450,17 @@ nsJSON::DecodeInternal(JSContext* cx,
     if (!available)
       break; // blocking input stream has none available when done
 
     if (available > PR_UINT32_MAX)
       available = PR_UINT32_MAX;
 
     rv = jsonListener->OnDataAvailable(jsonChannel, nullptr,
                                        aStream,
-                                       (uint32_t)NS_MIN(offset, (uint64_t)PR_UINT32_MAX),
+                                       offset,
                                        (uint32_t)available);
     if (NS_FAILED(rv)) {
       jsonChannel->Cancel(rv);
       break;
     }
 
     offset += available;
     jsonChannel->GetStatus(&status);
@@ -581,17 +581,17 @@ nsJSONListener::OnStopRequest(nsIRequest
   *mRootVal = value;
   mBufferedChars.TruncateLength(0);
   return ok ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsJSONListener::OnDataAvailable(nsIRequest *aRequest, nsISupports *aContext,
                                 nsIInputStream *aStream,
-                                uint32_t aOffset, uint32_t aLength)
+                                uint64_t aOffset, uint32_t aLength)
 {
   nsresult rv = NS_OK;
 
   if (mNeedsConverter && mSniffBuffer.Length() < 4) {
     uint32_t readCount = (aLength < 4) ? aLength : 4;
     rv = NS_ConsumeStream(aStream, readCount, mSniffBuffer);
     NS_ENSURE_SUCCESS(rv, rv);
 
--- a/dom/src/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/src/jsurl/nsJSProtocolHandler.cpp
@@ -1039,17 +1039,17 @@ nsJSChannel::OnStartRequest(nsIRequest* 
 
     return mListener->OnStartRequest(this, aContext);    
 }
 
 NS_IMETHODIMP
 nsJSChannel::OnDataAvailable(nsIRequest* aRequest,
                              nsISupports* aContext, 
                              nsIInputStream* aInputStream,
-                             uint32_t aOffset,
+                             uint64_t aOffset,
                              uint32_t aCount)
 {
     NS_ENSURE_TRUE(aRequest == mStreamChannel, NS_ERROR_UNEXPECTED);
 
     return mListener->OnDataAvailable(this, aContext, aInputStream, aOffset,
                                       aCount);
 }
 
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -774,19 +774,20 @@ NS_IMETHODIMP nsWebBrowserPersist::OnSto
 
     return NS_OK;
 }
 
 //*****************************************************************************
 // nsWebBrowserPersist::nsIStreamListener
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowserPersist::OnDataAvailable(
+NS_IMETHODIMP
+nsWebBrowserPersist::OnDataAvailable(
     nsIRequest* request, nsISupports *aContext, nsIInputStream *aIStream,
-    uint32_t aOffset, uint32_t aLength)
+    uint64_t aOffset, uint32_t aLength)
 {
     bool cancel = mCancel;
     if (!cancel)
     {
         nsresult rv = NS_OK;
         uint32_t bytesRemaining = aLength;
 
         nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp
@@ -91,17 +91,17 @@ nsAutoConfig::OnStartRequest(nsIRequest 
     return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsAutoConfig::OnDataAvailable(nsIRequest *request, 
                               nsISupports *context,
                               nsIInputStream *aIStream, 
-                              uint32_t aSourceOffset,
+                              uint64_t aSourceOffset,
                               uint32_t aLength)
 {    
     uint32_t amt, size;
     nsresult rv;
     char buf[1024];
     
     while (aLength) {
         size = NS_MIN<size_t>(aLength, sizeof(buf));
--- a/image/decoders/icon/mac/nsIconChannelCocoa.mm
+++ b/image/decoders/icon/mac/nsIconChannelCocoa.mm
@@ -104,17 +104,17 @@ NS_IMETHODIMP nsIconChannel::OnStopReque
 
   return NS_OK;
 }
 
 // nsIStreamListener methods
 NS_IMETHODIMP nsIconChannel::OnDataAvailable(nsIRequest* aRequest,
                                              nsISupports* aContext,
                                              nsIInputStream* aStream,
-                                             uint32_t aOffset,
+                                             uint64_t aOffset,
                                              uint32_t aCount)
 {
   if (mListener)
     return mListener->OnDataAvailable(this, aContext, aStream, aOffset, aCount);
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/image/decoders/icon/os2/nsIconChannel.cpp
+++ b/image/decoders/icon/os2/nsIconChannel.cpp
@@ -686,17 +686,17 @@ NS_IMETHODIMP nsIconChannel::OnStopReque
   return NS_OK;
 }
 
 //------------------------------------------------------------------------
 // nsIStreamListener methods
 NS_IMETHODIMP nsIconChannel::OnDataAvailable(nsIRequest* aRequest,
                                              nsISupports* aContext,
                                              nsIInputStream* aStream,
-                                             uint32_t aOffset,
+                                             uint64_t aOffset,
                                              uint32_t aCount)
 {
   if (mListener)
     return mListener->OnDataAvailable(this, aContext, aStream, aOffset, aCount);
   return NS_OK;
 }
 
 //------------------------------------------------------------------------
--- a/image/decoders/icon/win/nsIconChannel.cpp
+++ b/image/decoders/icon/win/nsIconChannel.cpp
@@ -699,15 +699,15 @@ NS_IMETHODIMP nsIconChannel::OnStopReque
 
   return NS_OK;
 }
 
 // nsIStreamListener methods
 NS_IMETHODIMP nsIconChannel::OnDataAvailable(nsIRequest* aRequest,
                                              nsISupports* aContext,
                                              nsIInputStream* aStream,
-                                             uint32_t aOffset,
+                                             uint64_t aOffset,
                                              uint32_t aCount)
 {
   if (mListener)
     return mListener->OnDataAvailable(this, aContext, aStream, aOffset, aCount);
   return NS_OK;
 }
--- a/image/src/SVGDocumentWrapper.cpp
+++ b/image/src/SVGDocumentWrapper.cpp
@@ -204,17 +204,17 @@ SVGDocumentWrapper::ResetAnimation()
 /** nsIStreamListener methods **/
 
 /* void onDataAvailable (in nsIRequest request, in nsISupports ctxt,
                          in nsIInputStream inStr, in unsigned long sourceOffset,
                          in unsigned long count); */
 NS_IMETHODIMP
 SVGDocumentWrapper::OnDataAvailable(nsIRequest* aRequest, nsISupports* ctxt,
                                     nsIInputStream* inStr,
-                                    uint32_t sourceOffset,
+                                    uint64_t sourceOffset,
                                     uint32_t count)
 {
   return mListener->OnDataAvailable(aRequest, ctxt, inStr,
                                     sourceOffset, count);
 }
 
 /** nsIRequestObserver methods **/
 
--- a/image/src/VectorImage.cpp
+++ b/image/src/VectorImage.cpp
@@ -688,17 +688,17 @@ VectorImage::OnStopRequest(nsIRequest* a
 // nsIStreamListener method
 
 //******************************************************************************
 /* void onDataAvailable(in nsIRequest request, in nsISupports ctxt,
                         in nsIInputStream inStr, in unsigned long sourceOffset,
                         in unsigned long count); */
 NS_IMETHODIMP
 VectorImage::OnDataAvailable(nsIRequest* aRequest, nsISupports* aCtxt,
-                             nsIInputStream* aInStr, uint32_t aSourceOffset,
+                             nsIInputStream* aInStr, uint64_t aSourceOffset,
                              uint32_t aCount)
 {
   if (mError)
     return NS_ERROR_FAILURE;
 
   return mSVGDocumentWrapper->OnDataAvailable(aRequest, aCtxt, aInStr,
                                               aSourceOffset, aCount);
 }
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -2078,18 +2078,21 @@ NS_IMETHODIMP ProxyListener::OnStopReque
   if (!mDestListener)
     return NS_ERROR_FAILURE;
 
   return mDestListener->OnStopRequest(aRequest, ctxt, status);
 }
 
 /** nsIStreamListener methods **/
 
-/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
-NS_IMETHODIMP ProxyListener::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt, nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count)
+/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long long sourceOffset, in unsigned long count); */
+NS_IMETHODIMP
+ProxyListener::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt,
+                               nsIInputStream *inStr, uint64_t sourceOffset,
+                               uint32_t count)
 {
   if (!mDestListener)
     return NS_ERROR_FAILURE;
 
   return mDestListener->OnDataAvailable(aRequest, ctxt, inStr, sourceOffset, count);
 }
 
 /**
@@ -2244,18 +2247,21 @@ NS_IMETHODIMP imgCacheValidator::OnStopR
     return NS_OK;
 
   return mDestListener->OnStopRequest(aRequest, ctxt, status);
 }
 
 /** nsIStreamListener methods **/
 
 
-/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
-NS_IMETHODIMP imgCacheValidator::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt, nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count)
+/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long long sourceOffset, in unsigned long count); */
+NS_IMETHODIMP
+imgCacheValidator::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt,
+                                   nsIInputStream *inStr,
+                                   uint64_t sourceOffset, uint32_t count)
 {
   if (!mDestListener) {
     // XXX see bug 113959
     uint32_t _retval;
     inStr->ReadSegments(NS_DiscardSegment, nullptr, count, &_retval);
     return NS_OK;
   }
 
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -936,18 +936,21 @@ NS_IMETHODIMP imgRequest::OnStopRequest(
 }
 
 /* prototype for these defined below */
 static NS_METHOD sniff_mimetype_callback(nsIInputStream* in, void* closure, const char* fromRawSegment,
                                          uint32_t toOffset, uint32_t count, uint32_t *writeCount);
 
 /** nsIStreamListener methods **/
 
-/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
-NS_IMETHODIMP imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt, nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count)
+/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long long sourceOffset, in unsigned long count); */
+NS_IMETHODIMP
+imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt,
+                            nsIInputStream *inStr, uint64_t sourceOffset,
+                            uint32_t count)
 {
   LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequest::OnDataAvailable", "count", count);
 
   NS_ASSERTION(aRequest, "imgRequest::OnDataAvailable -- no request!");
 
   nsresult rv;
 
   uint16_t imageType;
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -890,27 +890,27 @@ nsJARChannel::OnStopRequest(nsIRequest *
     mProgressSink = 0;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsJARChannel::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
                                nsIInputStream *stream,
-                               uint32_t offset, uint32_t count)
+                               uint64_t offset, uint32_t count)
 {
 #if defined(PR_LOGGING)
     LOG(("nsJARChannel::OnDataAvailable [this=%x %s]\n", this, mSpec.get()));
 #endif
 
     nsresult rv;
 
     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, nullptr, uint64_t(offset + count),
+        mProgressSink->OnProgress(this, nullptr, offset + count,
                                   uint64_t(mContentLength));
 
     return rv; // let the pump cancel on failure
 }
--- a/modules/libjar/zipwriter/src/nsDeflateConverter.cpp
+++ b/modules/libjar/zipwriter/src/nsDeflateConverter.cpp
@@ -97,21 +97,22 @@ NS_IMETHODIMP nsDeflateConverter::AsyncC
 
     mListener = aListener;
     mContext = aCtxt;
     return rv;
 }
 
 /* void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext,
  *                       in nsIInputStream aInputStream,
- *                       in unsigned long aOffset, in unsigned long aCount); */
+ *                       in unsigned long long aOffset,
+ *                       in unsigned long aCount); */
 NS_IMETHODIMP nsDeflateConverter::OnDataAvailable(nsIRequest *aRequest,
                                                   nsISupports *aContext,
                                                   nsIInputStream *aInputStream,
-                                                  uint32_t aOffset,
+                                                  uint64_t aOffset,
                                                   uint32_t aCount)
 {
     if (!mListener)
         return NS_ERROR_NOT_INITIALIZED;
 
     nsAutoArrayPtr<char> buffer(new char[aCount]);
     NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
 
--- a/modules/libjar/zipwriter/src/nsDeflateConverter.h
+++ b/modules/libjar/zipwriter/src/nsDeflateConverter.h
@@ -45,17 +45,17 @@ private:
     
     enum WrapMode {
         WRAP_ZLIB,
         WRAP_GZIP,
         WRAP_NONE
     };
 
     WrapMode mWrapMode;
-    uint32_t mOffset;
+    uint64_t mOffset;
     int32_t mLevel;
     nsCOMPtr<nsIStreamListener> mListener;
     nsCOMPtr<nsISupports> mContext;
     z_stream mZstream;
     unsigned char mWriteBuffer[ZIP_BUFLEN];
 
     nsresult Init();
     nsresult PushAvailableData(nsIRequest *aRequest, nsISupports *aContext);
--- a/modules/libjar/zipwriter/src/nsZipDataStream.cpp
+++ b/modules/libjar/zipwriter/src/nsZipDataStream.cpp
@@ -56,21 +56,21 @@ nsresult nsZipDataStream::Init(nsZipWrit
         mHeader->mMethod = ZIP_METHOD_STORE;
     }
 
     return NS_OK;
 }
 
 /* void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext,
  *                       in nsIInputStream aInputStream,
- *                       in unsigned long aOffset, in unsigned long aCount); */
+ *                       in unsigned long long aOffset, in unsigned long aCount); */
 NS_IMETHODIMP nsZipDataStream::OnDataAvailable(nsIRequest *aRequest,
                                                nsISupports *aContext,
                                                nsIInputStream *aInputStream,
-                                               uint32_t aOffset,
+                                               uint64_t aOffset,
                                                uint32_t aCount)
 {
     if (!mOutput)
         return NS_ERROR_NOT_INITIALIZED;
 
     nsAutoArrayPtr<char> buffer(new char[aCount]);
     NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
 
@@ -127,17 +127,17 @@ inline nsresult nsZipDataStream::Complet
 
     mHeader->mCSize = pos - mHeader->mOffset - mHeader->GetFileHeaderLength();
     mHeader->mWriteOnClose = true;
     return NS_OK;
 }
 
 nsresult nsZipDataStream::ProcessData(nsIRequest *aRequest,
                                       nsISupports *aContext, char *aBuffer,
-                                      uint32_t aOffset, uint32_t aCount)
+                                      uint64_t aOffset, uint32_t aCount)
 {
     mHeader->mCRC = crc32(mHeader->mCRC,
                           reinterpret_cast<const unsigned char*>(aBuffer),
                           aCount);
 
     nsresult rv;
     nsCOMPtr<nsIStringInputStream> stream =
              do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
--- a/modules/libjar/zipwriter/src/nsZipDataStream.h
+++ b/modules/libjar/zipwriter/src/nsZipDataStream.h
@@ -32,12 +32,12 @@ private:
 
     nsCOMPtr<nsIStreamListener> mOutput;
     nsCOMPtr<nsIOutputStream> mStream;
     nsRefPtr<nsZipWriter> mWriter;
     nsRefPtr<nsZipHeader> mHeader;
 
     nsresult CompleteEntry();
     nsresult ProcessData(nsIRequest *aRequest, nsISupports *aContext,
-                         char *aBuffer, uint32_t aOffset, uint32_t aCount);
+                         char *aBuffer, uint64_t aOffset, uint32_t aCount);
 };
 
 #endif
--- a/netwerk/base/public/nsIStreamListener.idl
+++ b/netwerk/base/public/nsIStreamListener.idl
@@ -5,38 +5,36 @@
 
 #include "nsIRequestObserver.idl"
 
 interface nsIInputStream;
 
 /**
  * nsIStreamListener
  */
-[scriptable, uuid(1a637020-1482-11d3-9333-00104ba0fd40)]
+[scriptable, uuid(3b4c8a77-76ba-4610-b316-678c73a3b88c)]
 interface nsIStreamListener : nsIRequestObserver
 {
     /**
      * Called when the next chunk of data (corresponding to the request) may
      * be read without blocking the calling thread.  The onDataAvailable impl
      * must read exactly |aCount| bytes of data before returning.
      *
      * @param aRequest request corresponding to the source of the data
      * @param aContext user defined context
      * @param aInputStream input stream containing the data chunk
      * @param aOffset
      *        Number of bytes that were sent in previous onDataAvailable calls
      *        for this request. In other words, the sum of all previous count
      *        parameters.
-     *        If that number is greater than or equal to 2^32, this parameter
-     *        will be PR_UINT32_MAX (2^32 - 1).
      * @param aCount number of bytes available in the stream
      *
      * NOTE: The aInputStream parameter must implement readSegments.
      *
      * An exception thrown from onDataAvailable has the side-effect of
      * causing the request to be canceled.
      */
     void onDataAvailable(in nsIRequest aRequest,
                          in nsISupports aContext, 
                          in nsIInputStream aInputStream,
-                         in unsigned long aOffset,
+                         in unsigned long long aOffset,
                          in unsigned long aCount);
 };
--- a/netwerk/base/src/nsBaseChannel.cpp
+++ b/netwerk/base/src/nsBaseChannel.cpp
@@ -733,25 +733,25 @@ nsBaseChannel::OnStopRequest(nsIRequest 
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsBaseChannel::nsIStreamListener
 
 NS_IMETHODIMP
 nsBaseChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
-                               nsIInputStream *stream, uint32_t offset,
+                               nsIInputStream *stream, uint64_t offset,
                                uint32_t count)
 {
   SUSPEND_PUMP_FOR_SCOPE();
 
   nsresult rv = mListener->OnDataAvailable(this, mListenerContext, stream,
                                            offset, count);
   if (mSynthProgressEvents && NS_SUCCEEDED(rv)) {
-    uint64_t prog = uint64_t(offset) + count;
+    uint64_t prog = offset + count;
     uint64_t progMax = ContentLength64();
     OnTransportStatus(nullptr, NS_NET_STATUS_READING, prog, progMax);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
--- a/netwerk/base/src/nsDownloader.cpp
+++ b/netwerk/base/src/nsDownloader.cpp
@@ -121,13 +121,13 @@ nsDownloader::ConsumeData(nsIInputStream
 
     *writeCount = count;
     return NS_OK;
 }
 
 NS_IMETHODIMP 
 nsDownloader::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, 
                               nsIInputStream *inStr, 
-                              uint32_t sourceOffset, uint32_t count)
+                              uint64_t sourceOffset, uint32_t count)
 {
     uint32_t n;  
     return inStr->ReadSegments(ConsumeData, this, count, &n);
 }
--- a/netwerk/base/src/nsIncrementalDownload.cpp
+++ b/netwerk/base/src/nsIncrementalDownload.cpp
@@ -647,17 +647,17 @@ nsIncrementalDownload::OnStopRequest(nsI
 }
 
 // nsIStreamListener
 
 NS_IMETHODIMP
 nsIncrementalDownload::OnDataAvailable(nsIRequest *request,
                                        nsISupports *context,
                                        nsIInputStream *input,
-                                       uint32_t offset,
+                                       uint64_t offset,
                                        uint32_t count)
 {
   while (count) {
     uint32_t space = mChunkSize - mChunkLen;
     uint32_t n, len = NS_MIN(space, count);
 
     nsresult rv = input->Read(mChunk + mChunkLen, len, &n);
     if (NS_FAILED(rv))
--- a/netwerk/base/src/nsInputStreamPump.cpp
+++ b/netwerk/base/src/nsInputStreamPump.cpp
@@ -467,32 +467,25 @@ nsInputStreamPump::OnStateTransfer()
             // a nsPipeInputStream, which implements nsISeekableStream::Tell).
             int64_t offsetBefore;
             nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mAsyncStream);
             if (seekable && NS_FAILED(seekable->Tell(&offsetBefore))) {
                 NS_NOTREACHED("Tell failed on readable stream");
                 offsetBefore = 0;
             }
 
-            // report the current stream offset to our listener... if we've
-            // streamed more than PR_UINT32_MAX, then avoid overflowing the
-            // stream offset.  it's the best we can do without a 64-bit stream
-            // listener API.
-            uint32_t odaOffset =
-                mStreamOffset > PR_UINT32_MAX ?
-                PR_UINT32_MAX : uint32_t(mStreamOffset);
             uint32_t odaAvail =
                 avail > PR_UINT32_MAX ?
                 PR_UINT32_MAX : uint32_t(avail);
 
-            LOG(("  calling OnDataAvailable [offset=%lld(%u) count=%llu(%u)]\n",
-                mStreamOffset, odaOffset, avail, odaAvail));
+            LOG(("  calling OnDataAvailable [offset=%llu count=%llu(%u)]\n",
+                mStreamOffset, avail, odaAvail));
 
             rv = mListener->OnDataAvailable(this, mListenerContext, mAsyncStream,
-                                            odaOffset, odaAvail);
+                                            mStreamOffset, odaAvail);
 
             // don't enter this code if ODA failed or called Cancel
             if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(mStatus)) {
                 // test to see if this ODA failed to consume data
                 if (seekable) {
                     // NOTE: if Tell fails, which can happen if the stream is
                     // now closed, then we assume that everything was read.
                     int64_t offsetAfter;
--- a/netwerk/base/src/nsSimpleStreamListener.cpp
+++ b/netwerk/base/src/nsSimpleStreamListener.cpp
@@ -41,17 +41,17 @@ nsSimpleStreamListener::OnStopRequest(ns
 //----------------------------------------------------------------------------
 // nsIStreamListener implementation...
 //----------------------------------------------------------------------------
 //
 NS_IMETHODIMP
 nsSimpleStreamListener::OnDataAvailable(nsIRequest* request,
                                         nsISupports *aContext,
                                         nsIInputStream *aSource,
-                                        uint32_t aOffset,
+                                        uint64_t aOffset,
                                         uint32_t aCount)
 {
     uint32_t writeCount;
     nsresult rv = mSink->WriteFrom(aSource, aCount, &writeCount);
     //
     // Equate zero bytes read and NS_SUCCEEDED to stopping the read.
     //
     if (NS_SUCCEEDED(rv) && (writeCount == 0))
--- a/netwerk/base/src/nsStreamListenerTee.cpp
+++ b/netwerk/base/src/nsStreamListenerTee.cpp
@@ -52,17 +52,17 @@ nsStreamListenerTee::OnStopRequest(nsIRe
     mObserver = 0;
     return rv;
 }
 
 NS_IMETHODIMP
 nsStreamListenerTee::OnDataAvailable(nsIRequest *request,
                                      nsISupports *context,
                                      nsIInputStream *input,
-                                     uint32_t offset,
+                                     uint64_t offset,
                                      uint32_t count)
 {
     NS_ENSURE_TRUE(mListener, NS_ERROR_NOT_INITIALIZED);
     NS_ENSURE_TRUE(mSink, NS_ERROR_NOT_INITIALIZED);
 
     nsCOMPtr<nsIInputStream> tee;
     nsresult rv;
 
--- a/netwerk/base/src/nsStreamLoader.cpp
+++ b/netwerk/base/src/nsStreamLoader.cpp
@@ -139,13 +139,13 @@ nsStreamLoader::WriteSegmentFun(nsIInput
   *writeCount = count;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 nsStreamLoader::OnDataAvailable(nsIRequest* request, nsISupports *ctxt, 
                                 nsIInputStream *inStr, 
-                                uint32_t sourceOffset, uint32_t count)
+                                uint64_t sourceOffset, uint32_t count)
 {
   uint32_t countRead;
   return inStr->ReadSegments(WriteSegmentFun, this, count, &countRead);
 }
--- a/netwerk/base/src/nsSyncStreamListener.cpp
+++ b/netwerk/base/src/nsSyncStreamListener.cpp
@@ -59,17 +59,17 @@ nsSyncStreamListener::OnStartRequest(nsI
 {
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSyncStreamListener::OnDataAvailable(nsIRequest     *request,
                                       nsISupports    *context,
                                       nsIInputStream *stream,
-                                      uint32_t        offset,
+                                      uint64_t        offset,
                                       uint32_t        count)
 {
     uint32_t bytesWritten;
 
     nsresult rv = mPipeOut->WriteFrom(stream, count, &bytesWritten);
 
     // if we get an error, then return failure.  this will cause the
     // channel to be canceled, and as a result our OnStopRequest method
--- a/netwerk/base/src/nsURIChecker.cpp
+++ b/netwerk/base/src/nsURIChecker.cpp
@@ -305,17 +305,17 @@ nsURIChecker::OnStopRequest(nsIRequest *
 }
 
 //-----------------------------------------------------------------------------
 // nsIStreamListener methods:
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsURIChecker::OnDataAvailable(nsIRequest *aRequest, nsISupports *aCtxt,
-                               nsIInputStream *aInput, uint32_t aOffset,
+                               nsIInputStream *aInput, uint64_t aOffset,
                                uint32_t aCount)
 {
     NS_NOTREACHED("nsURIChecker::OnDataAvailable");
     return NS_BINDING_ABORTED;
 }
 
 //-----------------------------------------------------------------------------
 // nsIInterfaceRequestor methods:
--- a/netwerk/base/src/nsUnicharStreamLoader.cpp
+++ b/netwerk/base/src/nsUnicharStreamLoader.cpp
@@ -101,17 +101,17 @@ nsUnicharStreamLoader::OnStopRequest(nsI
   return rv;
 }
 
 /* nsIStreamListener implementation */
 NS_IMETHODIMP
 nsUnicharStreamLoader::OnDataAvailable(nsIRequest *aRequest,
                                        nsISupports *aContext,
                                        nsIInputStream *aInputStream,
-                                       uint32_t aSourceOffset,
+                                       uint64_t aSourceOffset,
                                        uint32_t aCount)
 {
   if (!mObserver) {
     NS_ERROR("nsUnicharStreamLoader::OnDataAvailable called before ::Init");
     return NS_ERROR_UNEXPECTED;
   }
 
   mContext = aContext;
--- a/netwerk/protocol/ftp/FTPChannelChild.cpp
+++ b/netwerk/protocol/ftp/FTPChannelChild.cpp
@@ -263,41 +263,42 @@ FTPChannelChild::DoOnStartRequest(const 
   if (NS_FAILED(rv))
     Cancel(rv);
 }
 
 class FTPDataAvailableEvent : public ChannelEvent
 {
  public:
   FTPDataAvailableEvent(FTPChannelChild* aChild, const nsCString& aData,
-                        const uint32_t& aOffset, const uint32_t& aCount)
+                        const uint64_t& aOffset, const uint32_t& aCount)
   : mChild(aChild), mData(aData), mOffset(aOffset), mCount(aCount) {}
   void Run() { mChild->DoOnDataAvailable(mData, mOffset, mCount); }
  private:
   FTPChannelChild* mChild;
   nsCString mData;
-  uint32_t mOffset, mCount;
+  uint64_t mOffset;
+  uint32_t mCount;
 };
 
 bool
 FTPChannelChild::RecvOnDataAvailable(const nsCString& data,
-                                     const uint32_t& offset,
+                                     const uint64_t& offset,
                                      const uint32_t& count)
 {
   if (mEventQ.ShouldEnqueue()) {
     mEventQ.Enqueue(new FTPDataAvailableEvent(this, data, offset, count));
   } else {
     DoOnDataAvailable(data, offset, count);
   }
   return true;
 }
 
 void
 FTPChannelChild::DoOnDataAvailable(const nsCString& data,
-                                   const uint32_t& offset,
+                                   const uint64_t& offset,
                                    const uint32_t& count)
 {
   LOG(("FTPChannelChild::RecvOnDataAvailable [this=%x]\n", this));
 
   if (mCanceled)
     return;
 
   // NOTE: the OnDataAvailable contract requires the client to read all the data
--- a/netwerk/protocol/ftp/FTPChannelChild.h
+++ b/netwerk/protocol/ftp/FTPChannelChild.h
@@ -69,29 +69,29 @@ public:
 
 protected:
   bool RecvOnStartRequest(const int32_t& aContentLength,
                           const nsCString& aContentType,
                           const PRTime& aLastModified,
                           const nsCString& aEntityID,
                           const URIParams& aURI) MOZ_OVERRIDE;
   bool RecvOnDataAvailable(const nsCString& data,
-                           const uint32_t& offset,
+                           const uint64_t& offset,
                            const uint32_t& count) MOZ_OVERRIDE;
   bool RecvOnStopRequest(const nsresult& statusCode) MOZ_OVERRIDE;
   bool RecvFailedAsyncOpen(const nsresult& statusCode) MOZ_OVERRIDE;
   bool RecvDeleteSelf() MOZ_OVERRIDE;
 
   void DoOnStartRequest(const int32_t& aContentLength,
                         const nsCString& aContentType,
                         const PRTime& aLastModified,
                         const nsCString& aEntityID,
                         const URIParams& aURI);
   void DoOnDataAvailable(const nsCString& data,
-                         const uint32_t& offset,
+                         const uint64_t& offset,
                          const uint32_t& count);
   void DoOnStopRequest(const nsresult& statusCode);
   void DoFailedAsyncOpen(const nsresult& statusCode);
   void DoDeleteSelf();
 
   friend class FTPStartRequestEvent;
   friend class FTPDataAvailableEvent;
   friend class FTPStopRequestEvent;
--- a/netwerk/protocol/ftp/FTPChannelParent.cpp
+++ b/netwerk/protocol/ftp/FTPChannelParent.cpp
@@ -199,17 +199,17 @@ FTPChannelParent::OnStopRequest(nsIReque
 //-----------------------------------------------------------------------------
 // FTPChannelParent::nsIStreamListener
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 FTPChannelParent::OnDataAvailable(nsIRequest* aRequest,
                                   nsISupports* aContext,
                                   nsIInputStream* aInputStream,
-                                  uint32_t aOffset,
+                                  uint64_t aOffset,
                                   uint32_t aCount)
 {
   LOG(("FTPChannelParent::OnDataAvailable [this=%x]\n", this));
   
   nsCString data;
   nsresult rv = NS_ReadInputStreamToString(aInputStream, data, aCount);
   if (NS_FAILED(rv))
     return rv;
--- a/netwerk/protocol/ftp/PFTPChannel.ipdl
+++ b/netwerk/protocol/ftp/PFTPChannel.ipdl
@@ -33,17 +33,17 @@ parent:
   ConnectChannel(uint32_t channelId);
   Cancel(nsresult status);
   Suspend();
   Resume();
 
 child:
   OnStartRequest(int32_t aContentLength, nsCString aContentType,
                  PRTime aLastModified, nsCString aEntityID, URIParams aURI);
-  OnDataAvailable(nsCString data, uint32_t offset, uint32_t count);
+  OnDataAvailable(nsCString data, uint64_t offset, uint32_t count);
   OnStopRequest(nsresult statusCode);
   FailedAsyncOpen(nsresult statusCode);
   DeleteSelf();
 };
 
 } // namespace net
 } // namespace mozilla
 
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -292,17 +292,17 @@ HttpChannelChild::OnStartRequest(const n
 class TransportAndDataEvent : public ChannelEvent
 {
  public:
   TransportAndDataEvent(HttpChannelChild* child,
                         const nsresult& status,
                         const uint64_t& progress,
                         const uint64_t& progressMax,
                         const nsCString& data,
-                        const uint32_t& offset,
+                        const uint64_t& offset,
                         const uint32_t& count)
   : mChild(child)
   , mStatus(status)
   , mProgress(progress)
   , mProgressMax(progressMax)
   , mData(data)
   , mOffset(offset)
   , mCount(count) {}
@@ -310,26 +310,26 @@ class TransportAndDataEvent : public Cha
   void Run() { mChild->OnTransportAndData(mStatus, mProgress, mProgressMax,
                                           mData, mOffset, mCount); }
  private:
   HttpChannelChild* mChild;
   nsresult mStatus;
   uint64_t mProgress;
   uint64_t mProgressMax;
   nsCString mData;
-  uint32_t mOffset;
+  uint64_t mOffset;
   uint32_t mCount;
 };
 
 bool
 HttpChannelChild::RecvOnTransportAndData(const nsresult& status,
                                          const uint64_t& progress,
                                          const uint64_t& progressMax,
                                          const nsCString& data,
-                                         const uint32_t& offset,
+                                         const uint64_t& offset,
                                          const uint32_t& count)
 {
   if (mEventQ.ShouldEnqueue()) {
     mEventQ.Enqueue(new TransportAndDataEvent(this, status, progress,
                                               progressMax, data, offset, 
                                               count));
   } else {
     OnTransportAndData(status, progress, progressMax, data, offset, count);
@@ -337,17 +337,17 @@ HttpChannelChild::RecvOnTransportAndData
   return true;
 }
 
 void
 HttpChannelChild::OnTransportAndData(const nsresult& status,
                                      const uint64_t progress,
                                      const uint64_t& progressMax,
                                      const nsCString& data,
-                                     const uint32_t& offset,
+                                     const uint64_t& offset,
                                      const uint32_t& count)
 {
   LOG(("HttpChannelChild::OnTransportAndData [this=%x]\n", this));
 
   if (mCanceled)
     return;
 
   // cache the progress sink so we don't have to query for it each time.
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -98,17 +98,17 @@ protected:
                           const nsCString& cachedCharset,
                           const nsCString& securityInfoSerialization,
                           const PRNetAddr& selfAddr,
                           const PRNetAddr& peerAddr);
   bool RecvOnTransportAndData(const nsresult& status,
                               const uint64_t& progress,
                               const uint64_t& progressMax,
                               const nsCString& data,
-                              const uint32_t& offset,
+                              const uint64_t& offset,
                               const uint32_t& count);
   bool RecvOnStopRequest(const nsresult& statusCode);
   bool RecvOnProgress(const uint64_t& progress, const uint64_t& progressMax);
   bool RecvOnStatus(const nsresult& status);
   bool RecvFailedAsyncOpen(const nsresult& status);
   bool RecvRedirect1Begin(const uint32_t& newChannel,
                           const URIParams& newURI,
                           const uint32_t& redirectFlags,
@@ -152,17 +152,17 @@ private:
                       const nsCString& cachedCharset,
                       const nsCString& securityInfoSerialization,
                       const PRNetAddr& selfAddr,
                       const PRNetAddr& peerAddr);
   void OnTransportAndData(const nsresult& status,
                           const uint64_t progress,
                           const uint64_t& progressMax,
                           const nsCString& data,
-                          const uint32_t& offset,
+                          const uint64_t& offset,
                           const uint32_t& count);
   void OnStopRequest(const nsresult& statusCode);
   void OnProgress(const uint64_t& progress, const uint64_t& progressMax);
   void OnStatus(const nsresult& status);
   void FailedAsyncOpen(const nsresult& status);
   void HandleAsyncAbort();
   void Redirect1Begin(const uint32_t& newChannelId,
                       const URIParams& newUri,
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -462,17 +462,17 @@ HttpChannelParent::OnStopRequest(nsIRequ
 //-----------------------------------------------------------------------------
 // HttpChannelParent::nsIStreamListener
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelParent::OnDataAvailable(nsIRequest *aRequest, 
                                    nsISupports *aContext, 
                                    nsIInputStream *aInputStream, 
-                                   uint32_t aOffset, 
+                                   uint64_t aOffset, 
                                    uint32_t aCount)
 {
   LOG(("HttpChannelParent::OnDataAvailable [this=%x]\n", this));
 
   nsCString data;
   nsresult rv = NS_ReadInputStreamToString(aInputStream, data, aCount);
   if (NS_FAILED(rv))
     return rv;
--- a/netwerk/protocol/http/HttpChannelParentListener.cpp
+++ b/netwerk/protocol/http/HttpChannelParentListener.cpp
@@ -84,17 +84,17 @@ HttpChannelParentListener::OnStopRequest
 //-----------------------------------------------------------------------------
 // HttpChannelParentListener::nsIStreamListener
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelParentListener::OnDataAvailable(nsIRequest *aRequest, 
                                             nsISupports *aContext, 
                                             nsIInputStream *aInputStream, 
-                                            uint32_t aOffset, 
+                                            uint64_t aOffset, 
                                             uint32_t aCount)
 {
   if (!mActiveChannel)
     return NS_ERROR_UNEXPECTED;
 
   LOG(("HttpChannelParentListener::OnDataAvailable [this=%x]\n", this));
   return mActiveChannel->OnDataAvailable(aRequest, aContext, aInputStream, aOffset, aCount);
 }
--- a/netwerk/protocol/http/PHttpChannel.ipdl
+++ b/netwerk/protocol/http/PHttpChannel.ipdl
@@ -109,17 +109,17 @@ child:
                  PRNetAddr           peerAddr);
 
   // Combines a single OnDataAvailable and its associated OnProgress &
   // OnStatus calls into one IPDL message
   OnTransportAndData(nsresult  status,
                      uint64_t  progress,
                      uint64_t  progressMax,
                      nsCString data,
-                     uint32_t  offset,
+                     uint64_t  offset,
                      uint32_t  count);
 
   OnStopRequest(nsresult statusCode);
 
   OnProgress(uint64_t progress, uint64_t progressMax);
 
   OnStatus(nsresult status);
 
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -5011,20 +5011,20 @@ nsHttpChannel::OnStopRequest(nsIRequest 
 
 //-----------------------------------------------------------------------------
 // nsHttpChannel::nsIStreamListener
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
                                nsIInputStream *input,
-                               uint32_t offset, uint32_t count)
+                               uint64_t offset, uint32_t count)
 {
     SAMPLE_LABEL("network", "nsHttpChannel::OnDataAvailable");
-    LOG(("nsHttpChannel::OnDataAvailable [this=%p request=%p offset=%u count=%u]\n",
+    LOG(("nsHttpChannel::OnDataAvailable [this=%p request=%p offset=%llu count=%u]\n",
         this, request, offset, count));
 
     // don't send out OnDataAvailable notifications if we've been canceled.
     if (mCanceled)
         return mStatus;
 
     NS_ASSERTION(mResponseHead, "No response head in ODA!!");
 
@@ -5061,27 +5061,20 @@ nsHttpChannel::OnDataAvailable(nsIReques
 
         //
         // we have to manually keep the logical offset of the stream up-to-date.
         // we cannot depend solely on the offset provided, since we may have 
         // already streamed some data from another source (see, for example,
         // OnDoneReadingPartialCacheEntry).
         //
 
-        // report the current stream offset to our listener... if we've
-        // streamed more than PR_UINT32_MAX, then avoid overflowing the
-        // stream offset.  it's the best we can do without a 64-bit stream
-        // listener API. (Copied from nsInputStreamPump::OnStateTransfer.)
-        uint32_t odaOffset = mLogicalOffset > PR_UINT32_MAX
-                           ? PR_UINT32_MAX : uint32_t(mLogicalOffset);
-
         nsresult rv =  mListener->OnDataAvailable(this,
                                                   mListenerContext,
                                                   input,
-                                                  odaOffset,
+                                                  mLogicalOffset,
                                                   count);
         if (NS_SUCCEEDED(rv))
             mLogicalOffset = progress;
         return rv;
     }
 
     return NS_ERROR_ABORT;
 }
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
@@ -492,18 +492,19 @@ nsViewSourceChannel::OnStopRequest(nsIRe
                                                (this),
                                     aContext, aStatus);
 }
 
 
 // nsIStreamListener methods
 NS_IMETHODIMP
 nsViewSourceChannel::OnDataAvailable(nsIRequest *aRequest, nsISupports* aContext,
-                               nsIInputStream *aInputStream, uint32_t aSourceOffset,
-                               uint32_t aLength) 
+                                     nsIInputStream *aInputStream,
+                                     uint64_t aSourceOffset,
+                                     uint32_t aLength) 
 {
     NS_ENSURE_TRUE(mListener, NS_ERROR_FAILURE);
     return mListener->OnDataAvailable(static_cast<nsIViewSourceChannel*>
                                                  (this),
                                       aContext, aInputStream,
                                       aSourceOffset, aLength);
 }
 
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -3045,20 +3045,20 @@ WebSocketChannel::OnOutputStreamReady(ns
 }
 
 // nsIStreamListener
 
 NS_IMETHODIMP
 WebSocketChannel::OnDataAvailable(nsIRequest *aRequest,
                                     nsISupports *aContext,
                                     nsIInputStream *aInputStream,
-                                    uint32_t aOffset,
+                                    uint64_t aOffset,
                                     uint32_t aCount)
 {
-  LOG(("WebSocketChannel::OnDataAvailable() %p [%p %p %p %u %u]\n",
+  LOG(("WebSocketChannel::OnDataAvailable() %p [%p %p %p %llu %u]\n",
          this, aRequest, aContext, aInputStream, aOffset, aCount));
 
   if (aContext == mSocketIn) {
     // This is the deflate decoder
 
     LOG(("WebSocketChannel::OnDataAvailable: Deflate Data %u\n",
              aCount));
 
--- a/netwerk/protocol/wyciwyg/PWyciwygChannel.ipdl
+++ b/netwerk/protocol/wyciwyg/PWyciwygChannel.ipdl
@@ -35,17 +35,17 @@ parent:
 child:
   OnStartRequest(nsresult  statusCode,
                  int32_t   contentLength,
                  int32_t   source,
                  nsCString charset,
                  nsCString securityInfo);
 
   OnDataAvailable(nsCString data,
-                  uint32_t  offset);
+                  uint64_t  offset);
 
   OnStopRequest(nsresult statusCode);
 
   CancelEarly(nsresult statusCode);
 };
 
 
 } // namespace net
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
@@ -149,40 +149,40 @@ WyciwygChannelChild::OnStartRequest(cons
     Cancel(rv);
 }
 
 class WyciwygDataAvailableEvent : public ChannelEvent
 {
 public:
   WyciwygDataAvailableEvent(WyciwygChannelChild* child,
                             const nsCString& data,
-                            const uint32_t& offset)
+                            const uint64_t& offset)
   : mChild(child), mData(data), mOffset(offset) {}
   void Run() { mChild->OnDataAvailable(mData, mOffset); }
 private:
   WyciwygChannelChild* mChild;
   nsCString mData;
-  uint32_t mOffset;
+  uint64_t mOffset;
 };
 
 bool
 WyciwygChannelChild::RecvOnDataAvailable(const nsCString& data,
-                                         const uint32_t& offset)
+                                         const uint64_t& offset)
 {
   if (mEventQ.ShouldEnqueue()) {
     mEventQ.Enqueue(new WyciwygDataAvailableEvent(this, data, offset));
   } else {
     OnDataAvailable(data, offset);
   }
   return true;
 }
 
 void
 WyciwygChannelChild::OnDataAvailable(const nsCString& data,
-                                     const uint32_t& offset)
+                                     const uint64_t& offset)
 {
   LOG(("WyciwygChannelChild::RecvOnDataAvailable [this=%x]\n", this));
 
   if (mCanceled)
     return;
 
   mState = WCC_ONDATA;
 
@@ -204,17 +204,17 @@ WyciwygChannelChild::OnDataAvailable(con
   AutoEventEnqueuer ensureSerialDispatch(mEventQ);
   
   rv = mListener->OnDataAvailable(this, mListenerContext,
                                   stringStream, offset, data.Length());
   if (NS_FAILED(rv))
     Cancel(rv);
 
   if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
-    mProgressSink->OnProgress(this, nullptr, uint64_t(offset + data.Length()),
+    mProgressSink->OnProgress(this, nullptr, offset + data.Length(),
                               uint64_t(mContentLength));
 }
 
 class WyciwygStopRequestEvent : public ChannelEvent
 {
 public:
   WyciwygStopRequestEvent(WyciwygChannelChild* child,
                           const nsresult& statusCode)
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.h
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.h
@@ -53,27 +53,27 @@ public:
 
 protected:
   bool RecvOnStartRequest(const nsresult& statusCode,
                           const int32_t& contentLength,
                           const int32_t& source,
                           const nsCString& charset,
                           const nsCString& securityInfo);
   bool RecvOnDataAvailable(const nsCString& data,
-                           const uint32_t& offset);
+                           const uint64_t& offset);
   bool RecvOnStopRequest(const nsresult& statusCode);
   bool RecvCancelEarly(const nsresult& statusCode);
 
   void OnStartRequest(const nsresult& statusCode,
                       const int32_t& contentLength,
                       const int32_t& source,
                       const nsCString& charset,
                       const nsCString& securityInfo);
   void OnDataAvailable(const nsCString& data,
-                       const uint32_t& offset);
+                       const uint64_t& offset);
   void OnStopRequest(const nsresult& statusCode);
   void CancelEarly(const nsresult& statusCode);
 
 private:
   nsresult                          mStatus;
   bool                              mIsPending;
   bool                              mCanceled;
   uint32_t                          mLoadFlags;
--- a/netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
@@ -228,17 +228,17 @@ WyciwygChannelParent::OnStopRequest(nsIR
 //-----------------------------------------------------------------------------
 // WyciwygChannelParent::nsIStreamListener
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 WyciwygChannelParent::OnDataAvailable(nsIRequest *aRequest,
                                       nsISupports *aContext,
                                       nsIInputStream *aInputStream,
-                                      uint32_t aOffset,
+                                      uint64_t aOffset,
                                       uint32_t aCount)
 {
   LOG(("WyciwygChannelParent::OnDataAvailable [this=%x]\n", this));
 
   nsCString data;
   nsresult rv = NS_ReadInputStreamToString(aInputStream, data, aCount);
   if (NS_FAILED(rv))
     return rv;
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
@@ -588,28 +588,28 @@ nsWyciwygChannel::OnCacheEntryDoomed(nsr
 
 //-----------------------------------------------------------------------------
 // nsWyciwygChannel::nsIStreamListener
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsWyciwygChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctx,
                                   nsIInputStream *input,
-                                  uint32_t offset, uint32_t count)
+                                  uint64_t offset, uint32_t count)
 {
-  LOG(("nsWyciwygChannel::OnDataAvailable [this=%x request=%x offset=%u count=%u]\n",
+  LOG(("nsWyciwygChannel::OnDataAvailable [this=%x request=%x offset=%llu count=%u]\n",
       this, request, offset, count));
 
   nsresult rv;
   
   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, nullptr, uint64_t(offset + count),
+    mProgressSink->OnProgress(this, nullptr, offset + count,
                               uint64_t(mContentLength));
 
   return rv; // let the pump cancel on failure
 }
 
 //////////////////////////////////////////////////////////////////////////////
 // nsIRequestObserver
 //////////////////////////////////////////////////////////////////////////////
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -1299,17 +1299,17 @@ NS_IMETHODIMP
 mozTXTToHTMLConv::AsyncConvertData(const char *aFromType,
                                    const char *aToType,
                                    nsIStreamListener *aListener, nsISupports *aCtxt) {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 mozTXTToHTMLConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt,
-                                 nsIInputStream *inStr, uint32_t sourceOffset,
+                                 nsIInputStream *inStr, uint64_t sourceOffset,
                                  uint32_t count)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 mozTXTToHTMLConv::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
 {
--- a/netwerk/streamconv/converters/nsBinHexDecoder.cpp
+++ b/netwerk/streamconv/converters/nsBinHexDecoder.cpp
@@ -115,17 +115,17 @@ nsBinHexDecoder::AsyncConvertData(const 
 
 //////////////////////////////////////////////////////
 // nsIStreamListener methods...
 //////////////////////////////////////////////////////
 NS_IMETHODIMP
 nsBinHexDecoder::OnDataAvailable(nsIRequest* request,
                                  nsISupports *aCtxt,
                                  nsIInputStream *aStream,
-                                 uint32_t aSourceOffset,
+                                 uint64_t aSourceOffset,
                                  uint32_t aCount)
 {
   nsresult rv = NS_OK;
 
   if (mOutputStream && mDataBuffer && aCount > 0)
   {
     uint32_t numBytesRead = 0;
     while (aCount > 0) // while we still have bytes to copy...
--- a/netwerk/streamconv/converters/nsDirIndexParser.cpp
+++ b/netwerk/streamconv/converters/nsDirIndexParser.cpp
@@ -340,17 +340,17 @@ nsDirIndexParser::ParseData(nsIDirIndex 
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDirIndexParser::OnDataAvailable(nsIRequest *aRequest, nsISupports *aCtxt,
                                   nsIInputStream *aStream,
-                                  uint32_t aSourceOffset,
+                                  uint64_t aSourceOffset,
                                   uint32_t aCount) {
   if (aCount < 1)
     return NS_OK;
   
   int32_t len = mBuf.Length();
   
   // Ensure that our mBuf has capacity to hold the data we're about to
   // read.
--- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
+++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
@@ -72,17 +72,17 @@ nsFTPDirListingConv::AsyncConvertData(co
 
     return NS_OK;
 }
 
 
 // nsIStreamListener implementation
 NS_IMETHODIMP
 nsFTPDirListingConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt,
-                                  nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count) {
+                                  nsIInputStream *inStr, uint64_t sourceOffset, uint32_t count) {
     NS_ASSERTION(request, "FTP dir listing stream converter needs a request");
     
     nsresult rv;
 
     nsCOMPtr<nsIChannel> channel = do_QueryInterface(request, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
     
     uint32_t read, streamLen;
@@ -96,17 +96,17 @@ nsFTPDirListingConv::OnDataAvailable(nsI
     NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
 
     rv = inStr->Read(buffer, streamLen, &read);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // the dir listings are ascii text, null terminate this sucker.
     buffer[streamLen] = '\0';
 
-    PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("nsFTPDirListingConv::OnData(request = %x, ctxt = %x, inStr = %x, sourceOffset = %d, count = %d)\n", request, ctxt, inStr, sourceOffset, count));
+    PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("nsFTPDirListingConv::OnData(request = %x, ctxt = %x, inStr = %x, sourceOffset = %llu, count = %u)\n", request, ctxt, inStr, sourceOffset, count));
 
     if (!mBuffer.IsEmpty()) {
         // we have data left over from a previous OnDataAvailable() call.
         // combine the buffers so we don't lose any data.
         mBuffer.Append(buffer);
 
         buffer = new char[mBuffer.Length()+1];
         NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
--- a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp
+++ b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp
@@ -93,17 +93,17 @@ nsHTTPCompressConv::OnStopRequest(nsIReq
 {
     return mListener->OnStopRequest(request, aContext, aStatus);
 } 
 
 NS_IMETHODIMP
 nsHTTPCompressConv::OnDataAvailable(nsIRequest* request, 
                                     nsISupports *aContext, 
                                     nsIInputStream *iStr, 
-                                    uint32_t aSourceOffset, 
+                                    uint64_t aSourceOffset, 
                                     uint32_t aCount)
 {
     nsresult rv = NS_ERROR_INVALID_CONTENT_ENCODING;
     uint32_t streamLen = aCount;
 
     if (streamLen == 0)
     {
         NS_ERROR("count of zero passed to OnDataAvailable");
@@ -324,17 +324,17 @@ nsHTTPCompressConv::Convert(nsIInputStre
                             nsISupports *aCtxt, 
                             nsIInputStream **_retval)
 { 
     return NS_ERROR_NOT_IMPLEMENTED;
 } 
 
 nsresult
 nsHTTPCompressConv::do_OnDataAvailable(nsIRequest* request,
-                                       nsISupports *context, uint32_t offset,
+                                       nsISupports *context, uint64_t offset,
                                        const char *buffer, uint32_t count)
 {
     if (!mStream) {
         mStream = do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID);
         NS_ENSURE_STATE(mStream);
     }
 
     mStream->ShareData(buffer, count);
--- a/netwerk/streamconv/converters/nsHTTPCompressConv.h
+++ b/netwerk/streamconv/converters/nsHTTPCompressConv.h
@@ -62,17 +62,17 @@ private:
 
     uint32_t	mOutBufferLen;
     uint32_t	mInpBufferLen;
 	
     nsCOMPtr<nsISupports>   mAsyncConvContext;
     nsCOMPtr<nsIStringInputStream>  mStream;
 
     nsresult do_OnDataAvailable (nsIRequest *request, nsISupports *aContext,
-                                 uint32_t aSourceOffset, const char *buffer,
+                                 uint64_t aSourceOffset, const char *buffer,
                                  uint32_t aCount);
 
     bool        mCheckHeaderDone;
     bool        mStreamEnded;
     bool        mStreamInitialized;
     bool        mDummyStreamInitialised;
 
     z_stream d_stream;
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -743,17 +743,17 @@ nsIndexedToHTML::FormatInputStream(nsIRe
     }
     return (rv);
 }
 
 NS_IMETHODIMP
 nsIndexedToHTML::OnDataAvailable(nsIRequest *aRequest,
                                  nsISupports *aCtxt,
                                  nsIInputStream* aInput,
-                                 uint32_t aOffset,
+                                 uint64_t aOffset,
                                  uint32_t aCount) {
     return mParser->OnDataAvailable(aRequest, aCtxt, aInput, aOffset, aCount);
 }
 
 NS_IMETHODIMP
 nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
                                   nsISupports *aCtxt,
                                   nsIDirIndex *aIndex) {
--- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp
+++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp
@@ -69,17 +69,17 @@ void nsPartChannel::InitializeByteRange(
 
 nsresult nsPartChannel::SendOnStartRequest(nsISupports* aContext)
 {
     return mListener->OnStartRequest(this, aContext);
 }
 
 nsresult nsPartChannel::SendOnDataAvailable(nsISupports* aContext,
                                             nsIInputStream* aStream,
-                                            uint32_t aOffset, uint32_t aLen)
+                                            uint64_t aOffset, uint32_t aLen)
 {
     return mListener->OnDataAvailable(this, aContext, aStream, aOffset, aLen);
 }
 
 nsresult nsPartChannel::SendOnStopRequest(nsISupports* aContext,
                                           nsresult aStatus)
 {
     // Drop the listener
@@ -453,17 +453,18 @@ public:
   }
 private:
   char *mBuffer;
 };
 
 // nsIStreamListener implementation
 NS_IMETHODIMP
 nsMultiMixedConv::OnDataAvailable(nsIRequest *request, nsISupports *context,
-                                  nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count) {
+                                  nsIInputStream *inStr, uint64_t sourceOffset,
+                                  uint32_t count) {
 
     if (mToken.IsEmpty()) // no token, no love.
         return NS_ERROR_FAILURE;
 
     nsresult rv = NS_OK;
     AutoFree buffer = nullptr;
     uint32_t bufLen = 0, read = 0;
 
@@ -869,17 +870,17 @@ nsMultiMixedConv::SendData(char *aBuffer
         // XXX why? perhaps the Content-Length header was actually wrong!!
         if ((uint64_t(aLen) + mTotalSent) > mContentLength)
             aLen = mContentLength - mTotalSent;
 
         if (aLen == 0)
             return NS_OK;
     }
 
-    uint32_t offset = mTotalSent;
+    uint64_t offset = mTotalSent;
     mTotalSent += aLen;
 
     nsCOMPtr<nsIStringInputStream> ss(
             do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv));
     if (NS_FAILED(rv))
         return rv;
 
     rv = ss->ShareData(aBuffer, aLen);
--- a/netwerk/streamconv/converters/nsMultiMixedConv.h
+++ b/netwerk/streamconv/converters/nsMultiMixedConv.h
@@ -38,17 +38,17 @@ class nsPartChannel MOZ_FINAL : public n
 public:
   nsPartChannel(nsIChannel *aMultipartChannel, uint32_t aPartID,
                 nsIStreamListener* aListener);
 
   void InitializeByteRange(int64_t aStart, int64_t aEnd);
   void SetIsLastPart() { mIsLastPart = true; }
   nsresult SendOnStartRequest(nsISupports* aContext);
   nsresult SendOnDataAvailable(nsISupports* aContext, nsIInputStream* aStream,
-                               uint32_t aOffset, uint32_t aLen);
+                               uint64_t aOffset, uint32_t aLen);
   nsresult SendOnStopRequest(nsISupports* aContext, nsresult aStatus);
   /* SetContentDisposition expects the full value of the Content-Disposition
    * header */
   void SetContentDisposition(const nsACString& aContentDispositionHeader);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUEST
   NS_DECL_NSICHANNEL
--- a/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp
@@ -122,17 +122,17 @@ nsTXTToHTMLConv::PreFormatHTML(bool valu
     mPreFormatHTML = value;
     return NS_OK;
 }
 
 // nsIStreamListener method
 NS_IMETHODIMP
 nsTXTToHTMLConv::OnDataAvailable(nsIRequest* request, nsISupports *aContext,
                                  nsIInputStream *aInStream,
-                                 uint32_t aOffset, uint32_t aCount)
+                                 uint64_t aOffset, uint32_t aCount)
 {
     nsresult rv = NS_OK;
     nsString pushBuffer;
     uint32_t amtRead = 0;
     nsAutoArrayPtr<char> buffer(new char[aCount+1]);
     if (!buffer) return NS_ERROR_OUT_OF_MEMORY;
 
     do {
--- a/netwerk/streamconv/converters/nsUnknownDecoder.cpp
+++ b/netwerk/streamconv/converters/nsUnknownDecoder.cpp
@@ -105,17 +105,17 @@ nsUnknownDecoder::AsyncConvertData(const
 // nsIStreamListener methods...
 //
 // ----
 
 NS_IMETHODIMP
 nsUnknownDecoder::OnDataAvailable(nsIRequest* request, 
                                   nsISupports *aCtxt,
                                   nsIInputStream *aStream, 
-                                  uint32_t aSourceOffset, 
+                                  uint64_t aSourceOffset, 
                                   uint32_t aCount)
 {
   nsresult rv = NS_OK;
 
   if (!mNextListener) return NS_ERROR_FAILURE;
 
   if (mContentType.IsEmpty()) {
     uint32_t count, len;
--- a/netwerk/streamconv/test/Converters.cpp
+++ b/netwerk/streamconv/test/Converters.cpp
@@ -85,33 +85,33 @@ saturated(uint64_t aValue)
 }
 
 // nsIStreamListener method
 /* This method handles asyncronous conversion of data. */
 NS_IMETHODIMP
 TestConverter::OnDataAvailable(nsIRequest* request,
                                nsISupports *ctxt, 
                                nsIInputStream *inStr, 
-                               uint32_t sourceOffset, 
+                               uint64_t sourceOffset, 
                                uint32_t count) {
     nsresult rv;
     nsCOMPtr<nsIInputStream> convertedStream;
     // just make a syncronous call to the Convert() method.
     // Anything can happen here, I just happen to be using the sync call to 
     // do the actual conversion.
     rv = Convert(inStr, fromType.get(), toType.get(), ctxt, getter_AddRefs(convertedStream));
     if (NS_FAILED(rv)) return rv;
 
     uint64_t len = 0;
     convertedStream->Available(&len);
 
     uint64_t offset = sourceOffset;
     while (len > 0) {
         uint32_t count = saturated(len);
-        rv = mListener->OnDataAvailable(request, ctxt, convertedStream, saturated(offset), count);
+        rv = mListener->OnDataAvailable(request, ctxt, convertedStream, offset, count);
         if (NS_FAILED(rv)) return rv;
 
         offset += count;
         len -= count;
     }
     return NS_OK;
 }
 
--- a/netwerk/streamconv/test/TestStreamConv.cpp
+++ b/netwerk/streamconv/test/TestStreamConv.cpp
@@ -54,17 +54,17 @@ class EndListener MOZ_FINAL : public nsI
 public:
     // nsISupports declaration
     NS_DECL_ISUPPORTS
 
     EndListener() {};
 
     // nsIStreamListener method
     NS_IMETHOD OnDataAvailable(nsIRequest* request, nsISupports *ctxt, nsIInputStream *inStr, 
-                               uint32_t sourceOffset, uint32_t count)
+                               uint64_t sourceOffset, uint32_t count)
     {
         nsresult rv;
         uint32_t read;
         uint64_t len64;
         rv = inStr->Available(&len64);
         if (NS_FAILED(rv)) return rv;
         uint32_t len = (uint32_t)NS_MIN(len64, (uint64_t)(PR_UINT32_MAX - 1));
 
@@ -115,17 +115,17 @@ nsresult SendData(const char * aData, ns
 
     uint64_t avail = 0;
     dataStream->Available(&avail);
 
     uint64_t offset = 0;
     while (avail > 0) {
         uint32_t count = saturated(avail);
         rv = aListener->OnDataAvailable(request, nullptr, dataStream,
-                                        saturated(offset), count);
+                                        offset, count);
         if (NS_FAILED(rv)) return rv;
 
         offset += count;
         avail -= count;
     }
     return NS_OK;
 }
 #define SEND_DATA(x) SendData(x, converterListener, request)
--- a/netwerk/test/TestCallbacks.cpp
+++ b/netwerk/test/TestCallbacks.cpp
@@ -124,17 +124,17 @@ Consumer::OnStopRequest(nsIRequest *requ
     return rv;
 }
 
 
 // nsIStreamListener implementation
 NS_IMETHODIMP
 Consumer::OnDataAvailable(nsIRequest *request, nsISupports *aContext,
                           nsIInputStream *aIStream,
-                          uint32_t aOffset, uint32_t aLength) {
+                          uint64_t aOffset, uint32_t aLength) {
     fprintf(stderr, "Consumer::OnData() -> in\n\n");
 
     if (!mOnStart) {
         gError = true;
         fprintf(stderr, "ERROR: No OnStart received\n");
     }
 
     mOnDataCount += 1;
--- a/netwerk/test/TestHttp.cpp
+++ b/netwerk/test/TestHttp.cpp
@@ -50,17 +50,17 @@ MyListener::OnStopRequest(nsIRequest *re
     printf(">>> OnStopRequest status=%x\n", status);
     gKeepRunning = false;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 MyListener::OnDataAvailable(nsIRequest *req, nsISupports *ctxt,
                             nsIInputStream *stream,
-                            uint32_t offset, uint32_t count)
+                            uint64_t offset, uint32_t count)
 {
     printf(">>> OnDataAvailable [count=%u]\n", count);
 
     char buf[256];
     nsresult rv;
     uint32_t bytesRead=0;
 
     while (count) {
--- a/netwerk/test/TestMCTransport.cpp
+++ b/netwerk/test/TestMCTransport.cpp
@@ -88,19 +88,19 @@ TestListener::OnStopRequest(nsIRequest *
         fclose(mFile);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 TestListener::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
                               nsIInputStream *is,
-                              uint32_t offset, uint32_t count)
+                              uint64_t offset, uint32_t count)
 {
-    printf("OnDataAvailable: offset=%u count=%u\n", offset, count);
+    printf("OnDataAvailable: offset=%llu count=%u\n", offset, count);
 
     if (!mFile) return NS_ERROR_FAILURE;
 
     char buf[128];
     nsresult rv;
     uint32_t nread = 0;
 
     while (count) {
--- a/netwerk/test/TestOverlappedIO.cpp
+++ b/netwerk/test/TestOverlappedIO.cpp
@@ -69,20 +69,20 @@ TestListener::OnStartRequest(nsIRequest*
     LOG(("TestListener::OnStartRequest\n"));
     return NS_OK;
 }
 
 NS_IMETHODIMP
 TestListener::OnDataAvailable(nsIRequest* request,
                               nsISupports* context,
                               nsIInputStream *aIStream, 
-                              uint32_t aSourceOffset,
+                              uint64_t aSourceOffset,
                               uint32_t aLength)
 {
-    LOG(("TestListener::OnDataAvailable [offset=%u length=%u]\n",
+    LOG(("TestListener::OnDataAvailable [offset=%llu length=%u]\n",
         aSourceOffset, aLength));
     char buf[1025];
     uint32_t amt;
     while (1) {
         aIStream->Read(buf, 1024, &amt);
         if (amt == 0)
             break;
         buf[amt] = '\0';
--- a/netwerk/test/TestPageLoad.cpp
+++ b/netwerk/test/TestPageLoad.cpp
@@ -156,26 +156,26 @@ MyListener::OnStopRequest(nsIRequest *re
     if (--gKeepRunning == 0)
       QuitPumpingEvents();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 MyListener::OnDataAvailable(nsIRequest *req, nsISupports *ctxt,
                             nsIInputStream *stream,
-                            uint32_t offset, uint32_t count)
+                            uint64_t offset, uint32_t count)
 {
     //printf(">>> OnDataAvailable [count=%u]\n", count);
     nsresult rv = NS_ERROR_FAILURE;
     uint32_t bytesRead=0;
     char buf[1024];
 
     if(ctxt == nullptr) {
       bytesRead=0;
-      rv = stream->ReadSegments(streamParse, &offset, count, &bytesRead);
+      rv = stream->ReadSegments(streamParse, nullptr, count, &bytesRead);
     } else {
       while (count) {
         uint32_t amount = NS_MIN<uint32_t>(count, sizeof(buf));
         rv = stream->Read(buf, amount, &bytesRead);  
         count -= bytesRead;
       }
     }
 
--- a/netwerk/test/TestPerf.cpp
+++ b/netwerk/test/TestPerf.cpp
@@ -72,17 +72,17 @@ NS_IMETHODIMP
 MyListener::OnStartRequest(nsIRequest *req, nsISupports *ctx)
 {
     return NS_OK;
 }
 
 NS_IMETHODIMP
 MyListener::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
                             nsIInputStream *stream,
-                            uint32_t offset, uint32_t count)
+                            uint64_t offset, uint32_t count)
 {
     nsresult rv;
     char buf[4096];
     uint32_t n, bytesRead;
     while (count) {
         n = NS_MIN<uint32_t>(count, sizeof(buf));
         rv = stream->Read(buf, n, &bytesRead);
         if (NS_FAILED(rv))
--- a/netwerk/test/TestProtocols.cpp
+++ b/netwerk/test/TestProtocols.cpp
@@ -476,17 +476,17 @@ InputTestConsumer::OnStartRequest(nsIReq
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 InputTestConsumer::OnDataAvailable(nsIRequest *request, 
                                    nsISupports* context,
                                    nsIInputStream *aIStream, 
-                                   uint32_t aSourceOffset,
+                                   uint64_t aSourceOffset,
                                    uint32_t aLength)
 {
   char buf[1025];
   uint32_t amt, size;
   nsresult rv;
   URLLoadInfo* info = (URLLoadInfo*)context;
 
   while (aLength) {
--- a/netwerk/test/TestRes.cpp
+++ b/netwerk/test/TestRes.cpp
@@ -145,17 +145,17 @@ public:
             }
         }
         gDone = true;
         return NS_OK;
     }
 
     NS_IMETHOD OnDataAvailable(nsIRequest *request, nsISupports *ctxt, 
                                nsIInputStream *inStr,
-                               uint32_t sourceOffset, uint32_t count) {
+                               uint64_t sourceOffset, uint32_t count) {
         nsresult rv;
         char buf[1024];
         while (count > 0) {
             uint32_t amt;
             rv = inStr->Read(buf, sizeof(buf), &amt);
             count -= amt;
             char* c = buf;
             while (amt-- > 0) {
--- a/netwerk/test/TestSocketInput.cpp
+++ b/netwerk/test/TestSocketInput.cpp
@@ -33,26 +33,18 @@ public:
 
   InputTestConsumer();
   virtual ~InputTestConsumer();
 
   // ISupports interface...
   NS_DECL_ISUPPORTS
 
   // IStreamListener interface...
-  NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports* context);
-
-  NS_IMETHOD OnDataAvailable(nsIRequest *request, nsISupports* context,
-                             nsIInputStream *aIStream, 
-                             uint32_t aSourceOffset,
-                             uint32_t aLength);
-
-  NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports* context,
-                           nsresult aStatus);
-
+  NS_DECL_NSIREQUESTOBSERVER
+  NS_DECL_NSISTREAMLISTENER
 };
 
 
 InputTestConsumer::InputTestConsumer()
 {
 }
 
 InputTestConsumer::~InputTestConsumer()
@@ -70,17 +62,17 @@ InputTestConsumer::OnStartRequest(nsIReq
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 InputTestConsumer::OnDataAvailable(nsIRequest *request, 
                                    nsISupports* context,
                                    nsIInputStream *aIStream, 
-                                   uint32_t aSourceOffset,
+                                   uint64_t aSourceOffset,
                                    uint32_t aLength)
 {
   char buf[1025];
   while (aLength > 0) {
     uint32_t amt;
     aIStream->Read(buf, 1024, &amt);
     if (amt == 0) break;
     buf[amt] = '\0';
--- a/netwerk/test/TestStreamPump.cpp
+++ b/netwerk/test/TestStreamPump.cpp
@@ -49,19 +49,19 @@ public:
     NS_IMETHOD OnStartRequest(nsIRequest *req, nsISupports *ctx)
     {
         LOG(("MyListener::OnStartRequest\n"));
         return NS_OK;
     }
 
     NS_IMETHOD OnDataAvailable(nsIRequest *req, nsISupports *ctx,
                                nsIInputStream *stream,
-                               uint32_t offset, uint32_t count)
+                               uint64_t offset, uint32_t count)
     {
-        LOG(("MyListener::OnDataAvailable [offset=%u count=%u]\n", offset, count));
+        LOG(("MyListener::OnDataAvailable [offset=%llu count=%u]\n", offset, count));
 
         char buf[500];
         nsresult rv;
 
         while (count) {
             uint32_t n, amt = NS_MIN<uint32_t>(count, sizeof(buf));
 
             rv = stream->Read(buf, amt, &n);
--- a/netwerk/test/TestThreadedIO.cpp
+++ b/netwerk/test/TestThreadedIO.cpp
@@ -123,17 +123,17 @@ TestListener::OnStopRequest( nsIChannel 
 
     return rv;
 }
 
 NS_IMETHODIMP
 TestListener::OnDataAvailable( nsIChannel *aChannel,
                                nsISupports *aContext,
                                nsIInputStream *aStream,
-                               uint32_t offset,
+                               uint64_t offset,
                                uint32_t aLength ) {
     nsresult rv = NS_OK;
 
     printf( "TestListener::OnDataAvailable called on thread %d\n", mThreadNo );
 
     // Write the data to the console.
     // Read a buffer full till aLength bytes have been processed.
     char buffer[ 8192 ];
--- a/netwerk/test/TestUpload.cpp
+++ b/netwerk/test/TestUpload.cpp
@@ -60,17 +60,17 @@ InputTestConsumer::OnStartRequest(nsIReq
   LOG(("InputTestConsumer::OnStartRequest\n"));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 InputTestConsumer::OnDataAvailable(nsIRequest *request, 
                                    nsISupports* context,
                                    nsIInputStream *aIStream, 
-                                   uint32_t aSourceOffset,
+                                   uint64_t aSourceOffset,
                                    uint32_t aLength)
 {
   char buf[1025];
   uint32_t amt, size;
   nsresult rv;
 
   while (aLength) {
     size = NS_MIN<uint32_t>(aLength, sizeof(buf));
--- a/parser/html/nsHtml5StreamParser.cpp
+++ b/parser/html/nsHtml5StreamParser.cpp
@@ -1117,17 +1117,17 @@ class nsHtml5DataAvailable : public nsRu
     }
 };
 
 // nsIStreamListener method:
 nsresult
 nsHtml5StreamParser::OnDataAvailable(nsIRequest* aRequest,
                                nsISupports* aContext,
                                nsIInputStream* aInStream,
-                               uint32_t aSourceOffset,
+                               uint64_t aSourceOffset,
                                uint32_t aLength)
 {
   nsresult rv;
   if (NS_FAILED(rv = mExecutor->IsBroken())) {
     return rv;
   }
 
   NS_ASSERTION(mRequest == aRequest, "Got data on wrong stream.");
--- a/parser/htmlparser/src/nsParser.cpp
+++ b/parser/htmlparser/src/nsParser.cpp
@@ -2056,17 +2056,17 @@ ParserWriteFunc(nsIInputStream* in,
     *writeCount = count;
   }
 
   return result;
 }
 
 nsresult
 nsParser::OnDataAvailable(nsIRequest *request, nsISupports* aContext,
-                          nsIInputStream *pIStream, uint32_t sourceOffset,
+                          nsIInputStream *pIStream, uint64_t sourceOffset,
                           uint32_t aLength)
 {
   NS_PRECONDITION((eOnStart == mParserContext->mStreamListenerState ||
                    eOnDataAvail == mParserContext->mStreamListenerState),
             "Error: OnStartRequest() must be called before OnDataAvailable()");
   NS_PRECONDITION(NS_InputStreamIsBuffered(pIStream),
                   "Must have a buffered input stream");
 
--- a/parser/xml/src/nsSAXXMLReader.cpp
+++ b/parser/xml/src/nsSAXXMLReader.cpp
@@ -516,17 +516,17 @@ nsSAXXMLReader::ParseFromStream(nsIInput
     if (! available)
       break; // blocking input stream has none available when done
 
     if (available > PR_UINT32_MAX)
       available = PR_UINT32_MAX;
 
     rv = mListener->OnDataAvailable(parserChannel, nullptr,
                                     aStream,
-                                    (uint32_t)NS_MIN(offset, (uint64_t)PR_UINT32_MAX),
+                                    offset,
                                     (uint32_t)available);
     if (NS_SUCCEEDED(rv))
       offset += available;
     else
       parserChannel->Cancel(rv);
     parserChannel->GetStatus(&status);
   }
   rv = mListener->OnStopRequest(parserChannel, nullptr, status);
@@ -571,17 +571,17 @@ nsSAXXMLReader::OnStopRequest(nsIRequest
   mIsAsyncParse = false;
   return rv;
 }
 
 // nsIStreamListener
 
 NS_IMETHODIMP
 nsSAXXMLReader::OnDataAvailable(nsIRequest *aRequest, nsISupports *aContext,
-                                nsIInputStream *aInputStream, uint32_t offset,
+                                nsIInputStream *aInputStream, uint64_t offset,
                                 uint32_t count)
 {
   NS_ENSURE_TRUE(mIsAsyncParse, NS_ERROR_FAILURE);
   NS_ENSURE_STATE(mListener);
   return mListener->OnDataAvailable(aRequest, aContext, aInputStream, offset,
                                     count);
 }
 
--- a/rdf/base/src/nsRDFXMLDataSource.cpp
+++ b/rdf/base/src/nsRDFXMLDataSource.cpp
@@ -531,17 +531,17 @@ RDFXMLDataSourceImpl::BlockingParse(nsIU
             break; // error
 
         if (avail == 0)
             break; // eof
 
         if (avail > PR_UINT32_MAX)
             avail = PR_UINT32_MAX;
 
-        rv = aConsumer->OnDataAvailable(channel, nullptr, bufStream, (uint32_t)NS_MIN(offset, (uint64_t)PR_UINT32_MAX), (uint32_t)avail);
+        rv = aConsumer->OnDataAvailable(channel, nullptr, bufStream, offset, (uint32_t)avail);
         if (NS_SUCCEEDED(rv))
             offset += avail;
     }
 
     if (NS_FAILED(rv))
         channel->Cancel(rv);
 
     channel->GetStatus(&rv);
@@ -1138,17 +1138,17 @@ RDFXMLDataSourceImpl::OnStopRequest(nsIR
 //
 // nsIStreamListener
 //
 
 NS_IMETHODIMP
 RDFXMLDataSourceImpl::OnDataAvailable(nsIRequest *request,
                                       nsISupports *ctxt,
                                       nsIInputStream *inStr,
-                                      uint32_t sourceOffset,
+                                      uint64_t sourceOffset,
                                       uint32_t count)
 {
     return mListener->OnDataAvailable(request, ctxt, inStr, sourceOffset, count);
 }
 
 //----------------------------------------------------------------------
 //
 // nsIRDFXMLSource
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -3178,17 +3178,17 @@ PSMContentDownloader::OnStartRequest(nsI
   mBufferSize = contentLength;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PSMContentDownloader::OnDataAvailable(nsIRequest* request,
                                 nsISupports* context,
                                 nsIInputStream *aIStream,
-                                uint32_t aSourceOffset,
+                                uint64_t aSourceOffset,
                                 uint32_t aLength)
 {
   if (!mByteData)
     return NS_ERROR_OUT_OF_MEMORY;
   
   uint32_t amt;
   nsresult err;
   //Do a check to see if we need to allocate more memory.
--- a/toolkit/components/places/AsyncFaviconHelpers.cpp
+++ b/toolkit/components/places/AsyncFaviconHelpers.cpp
@@ -608,17 +608,17 @@ AsyncFetchAndSetIconFromNetwork::OnStart
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AsyncFetchAndSetIconFromNetwork::OnDataAvailable(nsIRequest* aRequest,
                                                  nsISupports* aContext,
                                                  nsIInputStream* aInputStream,
-                                                 uint32_t aOffset,
+                                                 uint64_t aOffset,
                                                  uint32_t aCount)
 {
   nsAutoCString buffer;
   nsresult rv = NS_ConsumeStream(aInputStream, aCount, buffer);
   if (rv != NS_BASE_STREAM_WOULD_BLOCK && NS_FAILED(rv)) {
     return rv;
   }
 
--- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
@@ -443,17 +443,17 @@ nsUrlClassifierStreamUpdater::OnStartReq
 
   return status;
 }
 
 NS_IMETHODIMP
 nsUrlClassifierStreamUpdater::OnDataAvailable(nsIRequest *request,
                                               nsISupports* context,
                                               nsIInputStream *aIStream,
-                                              uint32_t aSourceOffset,
+                                              uint64_t aSourceOffset,
                                               uint32_t aLength)
 {
   if (!mDBService)
     return NS_ERROR_NOT_INITIALIZED;
 
   LOG(("OnDataAvailable (%d bytes)", aLength));
 
   nsresult rv;
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -272,18 +272,20 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStar
   if (m_targetStreamListener)
     rv = m_targetStreamListener->OnStartRequest(request, aCtxt);
 
   LOG(("  OnStartRequest returning: 0x%08X", rv));
   
   return rv;
 }
 
-NS_IMETHODIMP nsDocumentOpenInfo::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
-                                                  nsIInputStream * inStr, uint32_t sourceOffset, uint32_t count)
+NS_IMETHODIMP
+nsDocumentOpenInfo::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
+                                    nsIInputStream * inStr,
+                                    uint64_t sourceOffset, uint32_t count)
 {
   TIME_URILOADER_FUNCTION(request);
 
   // if we have retarged to the end stream listener, then forward the call....
   // otherwise, don't do anything
 
   nsresult rv = NS_OK;
   
--- a/uriloader/exthandler/ExternalHelperAppChild.cpp
+++ b/uriloader/exthandler/ExternalHelperAppChild.cpp
@@ -28,17 +28,17 @@ ExternalHelperAppChild::~ExternalHelperA
 
 //-----------------------------------------------------------------------------
 // nsIStreamListener
 //-----------------------------------------------------------------------------
 NS_IMETHODIMP
 ExternalHelperAppChild::OnDataAvailable(nsIRequest *request,
                                         nsISupports *ctx,
                                         nsIInputStream *input,
-                                        uint32_t offset,
+                                        uint64_t offset,
                                         uint32_t count)
 {
   if (NS_FAILED(mStatus))
     return mStatus;
 
   nsCString data;
   nsresult rv = NS_ReadInputStreamToString(input, data, count);
   if (NS_FAILED(rv))
--- a/uriloader/exthandler/ExternalHelperAppParent.cpp
+++ b/uriloader/exthandler/ExternalHelperAppParent.cpp
@@ -71,17 +71,17 @@ ExternalHelperAppParent::RecvOnStartRequ
   mEntityID = entityID;
   mPending = true;
   mStatus = mListener->OnStartRequest(this, nullptr);
   return true;
 }
 
 bool
 ExternalHelperAppParent::RecvOnDataAvailable(const nsCString& data,
-                                             const uint32_t& offset,
+                                             const uint64_t& offset,
                                              const uint32_t& count)
 {
   if (NS_FAILED(mStatus))
     return true;
 
   NS_ASSERTION(mPending, "must be pending!");
   nsCOMPtr<nsIInputStream> stringStream;
   DebugOnly<nsresult> rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), count, NS_ASSIGNMENT_DEPEND);
--- a/uriloader/exthandler/ExternalHelperAppParent.h
+++ b/uriloader/exthandler/ExternalHelperAppParent.h
@@ -35,17 +35,17 @@ class ExternalHelperAppParent : public P
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIREQUEST
     NS_DECL_NSICHANNEL
     NS_DECL_NSIMULTIPARTCHANNEL
     NS_DECL_NSIRESUMABLECHANNEL
 
     bool RecvOnStartRequest(const nsCString& entityID);
-    bool RecvOnDataAvailable(const nsCString& data, const uint32_t& offset, const uint32_t& count);
+    bool RecvOnDataAvailable(const nsCString& data, const uint64_t& offset, const uint32_t& count);
     bool RecvOnStopRequest(const nsresult& code);
 
     ExternalHelperAppParent(const OptionalURIParams& uri, const int64_t& contentLength);
     void Init(ContentParent *parent,
               const nsCString& aMimeContentType,
               const nsCString& aContentDisposition,
               const bool& aForceSave,
               const OptionalURIParams& aReferrer);
@@ -60,9 +60,9 @@ private:
   int64_t mContentLength;
   uint32_t mContentDisposition;
   nsString mContentDispositionFilename;
   nsCString mContentDispositionHeader;
   nsCString mEntityID;
 };
 
 } // namespace dom
-} // namespace mozilla
\ No newline at end of file
+} // namespace mozilla
--- a/uriloader/exthandler/PExternalHelperApp.ipdl
+++ b/uriloader/exthandler/PExternalHelperApp.ipdl
@@ -8,17 +8,17 @@ namespace mozilla {
 namespace dom {
 
 protocol PExternalHelperApp
 {
   manager PContent;
 
 parent:
   OnStartRequest(nsCString entityID);
-  OnDataAvailable(nsCString data, uint32_t offset, uint32_t count);
+  OnDataAvailable(nsCString data, uint64_t offset, uint32_t count);
   OnStopRequest(nsresult code);
 
 child:
   Cancel(nsresult aStatus);
   __delete__();
 };
 
 
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1738,18 +1738,20 @@ void nsExternalAppHandler::SendStatusCha
                   prompter->Alert(title, msgText);
                 }
               }
             }
         }
     }
 }
 
-NS_IMETHODIMP nsExternalAppHandler::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
-                                                  nsIInputStream * inStr, uint32_t sourceOffset, uint32_t count)
+NS_IMETHODIMP
+nsExternalAppHandler::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
+                                      nsIInputStream * inStr,
+                                      uint64_t sourceOffset, uint32_t count)
 {
   nsresult rv = NS_OK;
   // first, check to see if we've been canceled....
   if (mCanceled || !mDataBuffer) // then go cancel our underlying channel too
     return request->Cancel(NS_BINDING_ABORTED);
 
   // read the data out of the stream and write it to the temp file.
   if (mOutStream && count > 0)
--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp
@@ -207,17 +207,17 @@ nsManifestCheck::OnStartRequest(nsIReque
 {
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsManifestCheck::OnDataAvailable(nsIRequest *aRequest,
                                  nsISupports *aContext,
                                  nsIInputStream *aStream,
-                                 uint32_t aOffset,
+                                 uint64_t aOffset,
                                  uint32_t aCount)
 {
     uint32_t bytesRead;
     aStream->ReadSegments(ReadManifest, this, aCount, &bytesRead);
     return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -387,23 +387,23 @@ nsOfflineCacheUpdateItem::OnStartRequest
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsOfflineCacheUpdateItem::OnDataAvailable(nsIRequest *aRequest,
                                           nsISupports *aContext,
                                           nsIInputStream *aStream,
-                                          uint32_t aOffset,
+                                          uint64_t aOffset,
                                           uint32_t aCount)
 {
     uint32_t bytesRead = 0;
     aStream->ReadSegments(NS_DiscardSegment, nullptr, aCount, &bytesRead);
     mBytesRead += bytesRead;
-    LOG(("loaded %u bytes into offline cache [offset=%u]\n",
+    LOG(("loaded %u bytes into offline cache [offset=%llu]\n",
          bytesRead, aOffset));
 
     mUpdate->OnByteProgress(bytesRead);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -1075,17 +1075,17 @@ nsOfflineManifestItem::OnStartRequest(ns
 
     return nsOfflineCacheUpdateItem::OnStartRequest(aRequest, aContext);
 }
 
 NS_IMETHODIMP
 nsOfflineManifestItem::OnDataAvailable(nsIRequest *aRequest,
                                        nsISupports *aContext,
                                        nsIInputStream *aStream,
-                                       uint32_t aOffset,
+                                       uint64_t aOffset,
                                        uint32_t aCount)
 {
     uint32_t bytesRead = 0;
     aStream->ReadSegments(ReadManifest, this, aCount, &bytesRead);
     mBytesRead += bytesRead;
 
     if (mParserState == PARSE_ERROR) {
         LOG(("OnDataAvailable is canceling the request due a parse error\n"));
--- a/uriloader/prefetch/nsPrefetchService.cpp
+++ b/uriloader/prefetch/nsPrefetchService.cpp
@@ -276,23 +276,23 @@ nsPrefetchNode::OnStartRequest(nsIReques
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrefetchNode::OnDataAvailable(nsIRequest *aRequest,
                                 nsISupports *aContext,
                                 nsIInputStream *aStream,
-                                uint32_t aOffset,
+                                uint64_t aOffset,
                                 uint32_t aCount)
 {
     uint32_t bytesRead = 0;
     aStream->ReadSegments(NS_DiscardSegment, nullptr, aCount, &bytesRead);
     mBytesRead += bytesRead;
-    LOG(("prefetched %u bytes [offset=%u]\n", bytesRead, aOffset));
+    LOG(("prefetched %u bytes [offset=%llu]\n", bytesRead, aOffset));
     return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsPrefetchNode::OnStopRequest(nsIRequest *aRequest,
                               nsISupports *aContext,
                               nsresult aStatus)
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -85,21 +85,22 @@ STDMETHODIMP nsDataObj::CStream::QueryIn
     ((LPUNKNOWN)*ppvResult)->AddRef();
     return S_OK;
   }
 
   return E_NOINTERFACE;
 }
 
 // nsIStreamListener implementation
-NS_IMETHODIMP nsDataObj::CStream::OnDataAvailable(nsIRequest *aRequest,
-                                                  nsISupports *aContext,
-                                                  nsIInputStream *aInputStream,
-                                                  uint32_t aOffset, // offset within the stream
-                                                  uint32_t aCount) // bytes available on this call
+NS_IMETHODIMP
+nsDataObj::CStream::OnDataAvailable(nsIRequest *aRequest,
+                                    nsISupports *aContext,
+                                    nsIInputStream *aInputStream,
+                                    uint64_t aOffset, // offset within the stream
+                                    uint32_t aCount) // bytes available on this call
 {
     // Extend the write buffer for the incoming data.
     uint8_t* buffer = mChannelData.AppendElements(aCount);
     if (buffer == NULL)
       return NS_ERROR_OUT_OF_MEMORY;
     NS_ASSERTION((mChannelData.Length() == (aOffset + aCount)),
       "stream length mismatch w/write buffer");
 
--- a/xpfe/components/directory/nsDirectoryViewer.cpp
+++ b/xpfe/components/directory/nsDirectoryViewer.cpp
@@ -343,17 +343,17 @@ nsHTTPIndex::OnStopRequest(nsIRequest *r
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsHTTPIndex::OnDataAvailable(nsIRequest *request,
                              nsISupports* aContext,
                              nsIInputStream* aStream,
-                             uint32_t aSourceOffset,
+                             uint64_t aSourceOffset,
                              uint32_t aCount)
 {
   // If mDirectory isn't set, then we should just bail. Either an
   // error occurred and OnStartRequest() never got called, or
   // something exploded in OnStartRequest().
   if (! mDirectory)
     return NS_BINDING_ABORTED;