mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
3b41ff2b83
--HG-- rename : netwerk/base/src/ADivertableParentChannel.h => netwerk/base/ADivertableParentChannel.h rename : netwerk/base/src/ArrayBufferInputStream.cpp => netwerk/base/ArrayBufferInputStream.cpp rename : netwerk/base/src/ArrayBufferInputStream.h => netwerk/base/ArrayBufferInputStream.h rename : netwerk/base/src/AutoClose.h => netwerk/base/AutoClose.h rename : netwerk/base/src/BackgroundFileSaver.cpp => netwerk/base/BackgroundFileSaver.cpp rename : netwerk/base/src/BackgroundFileSaver.h => netwerk/base/BackgroundFileSaver.h rename : netwerk/base/src/ChannelDiverterChild.cpp => netwerk/base/ChannelDiverterChild.cpp rename : netwerk/base/src/ChannelDiverterChild.h => netwerk/base/ChannelDiverterChild.h rename : netwerk/base/src/ChannelDiverterParent.cpp => netwerk/base/ChannelDiverterParent.cpp rename : netwerk/base/src/ChannelDiverterParent.h => netwerk/base/ChannelDiverterParent.h rename : netwerk/base/src/Dashboard.cpp => netwerk/base/Dashboard.cpp rename : netwerk/base/src/Dashboard.h => netwerk/base/Dashboard.h rename : netwerk/base/src/DashboardTypes.h => netwerk/base/DashboardTypes.h rename : netwerk/base/src/EventTokenBucket.cpp => netwerk/base/EventTokenBucket.cpp rename : netwerk/base/src/EventTokenBucket.h => netwerk/base/EventTokenBucket.h rename : netwerk/base/src/LoadContextInfo.cpp => netwerk/base/LoadContextInfo.cpp rename : netwerk/base/src/LoadContextInfo.h => netwerk/base/LoadContextInfo.h rename : netwerk/base/public/NetStatistics.h => netwerk/base/NetStatistics.h rename : netwerk/base/src/NetUtil.jsm => netwerk/base/NetUtil.jsm rename : netwerk/base/src/NetworkActivityMonitor.cpp => netwerk/base/NetworkActivityMonitor.cpp rename : netwerk/base/src/NetworkActivityMonitor.h => netwerk/base/NetworkActivityMonitor.h rename : netwerk/base/src/OfflineObserver.cpp => netwerk/base/OfflineObserver.cpp rename : netwerk/base/src/OfflineObserver.h => netwerk/base/OfflineObserver.h rename : netwerk/base/src/Predictor.cpp => netwerk/base/Predictor.cpp rename : netwerk/base/src/Predictor.h => netwerk/base/Predictor.h rename : netwerk/base/src/PrivateBrowsingChannel.h => netwerk/base/PrivateBrowsingChannel.h rename : netwerk/base/src/ProxyAutoConfig.cpp => netwerk/base/ProxyAutoConfig.cpp rename : netwerk/base/src/ProxyAutoConfig.h => netwerk/base/ProxyAutoConfig.h rename : netwerk/base/src/RedirectChannelRegistrar.cpp => netwerk/base/RedirectChannelRegistrar.cpp rename : netwerk/base/src/RedirectChannelRegistrar.h => netwerk/base/RedirectChannelRegistrar.h rename : netwerk/base/public/ReferrerPolicy.h => netwerk/base/ReferrerPolicy.h rename : netwerk/base/src/StreamingProtocolService.cpp => netwerk/base/StreamingProtocolService.cpp rename : netwerk/base/src/StreamingProtocolService.h => netwerk/base/StreamingProtocolService.h rename : netwerk/base/src/TLSServerSocket.cpp => netwerk/base/TLSServerSocket.cpp rename : netwerk/base/src/TLSServerSocket.h => netwerk/base/TLSServerSocket.h rename : netwerk/base/src/Tickler.cpp => netwerk/base/Tickler.cpp rename : netwerk/base/src/Tickler.h => netwerk/base/Tickler.h rename : netwerk/base/public/mozIThirdPartyUtil.idl => netwerk/base/mozIThirdPartyUtil.idl rename : netwerk/base/public/netCore.h => netwerk/base/netCore.h rename : netwerk/base/public/nsASocketHandler.h => netwerk/base/nsASocketHandler.h rename : netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp => netwerk/base/nsAsyncRedirectVerifyHelper.cpp rename : netwerk/base/public/nsAsyncRedirectVerifyHelper.h => netwerk/base/nsAsyncRedirectVerifyHelper.h rename : netwerk/base/src/nsAsyncStreamCopier.cpp => netwerk/base/nsAsyncStreamCopier.cpp rename : netwerk/base/src/nsAsyncStreamCopier.h => netwerk/base/nsAsyncStreamCopier.h rename : netwerk/base/src/nsAuthInformationHolder.cpp => netwerk/base/nsAuthInformationHolder.cpp rename : netwerk/base/src/nsAuthInformationHolder.h => netwerk/base/nsAuthInformationHolder.h rename : netwerk/base/src/nsAutodialQt.cpp => netwerk/base/nsAutodialQt.cpp rename : netwerk/base/src/nsAutodialQt.h => netwerk/base/nsAutodialQt.h rename : netwerk/base/src/nsAutodialWin.cpp => netwerk/base/nsAutodialWin.cpp rename : netwerk/base/src/nsAutodialWin.h => netwerk/base/nsAutodialWin.h rename : netwerk/base/src/nsBase64Encoder.cpp => netwerk/base/nsBase64Encoder.cpp rename : netwerk/base/src/nsBase64Encoder.h => netwerk/base/nsBase64Encoder.h rename : netwerk/base/src/nsBaseChannel.cpp => netwerk/base/nsBaseChannel.cpp rename : netwerk/base/src/nsBaseChannel.h => netwerk/base/nsBaseChannel.h rename : netwerk/base/src/nsBaseContentStream.cpp => netwerk/base/nsBaseContentStream.cpp rename : netwerk/base/src/nsBaseContentStream.h => netwerk/base/nsBaseContentStream.h rename : netwerk/base/src/nsBufferedStreams.cpp => netwerk/base/nsBufferedStreams.cpp rename : netwerk/base/src/nsBufferedStreams.h => netwerk/base/nsBufferedStreams.h rename : netwerk/base/src/nsChannelClassifier.cpp => netwerk/base/nsChannelClassifier.cpp rename : netwerk/base/src/nsChannelClassifier.h => netwerk/base/nsChannelClassifier.h rename : netwerk/base/src/nsDNSPrefetch.cpp => netwerk/base/nsDNSPrefetch.cpp rename : netwerk/base/src/nsDNSPrefetch.h => netwerk/base/nsDNSPrefetch.h rename : netwerk/base/src/nsDirectoryIndexStream.cpp => netwerk/base/nsDirectoryIndexStream.cpp rename : netwerk/base/src/nsDirectoryIndexStream.h => netwerk/base/nsDirectoryIndexStream.h rename : netwerk/base/src/nsDownloader.cpp => netwerk/base/nsDownloader.cpp rename : netwerk/base/src/nsDownloader.h => netwerk/base/nsDownloader.h rename : netwerk/base/src/nsFileStreams.cpp => netwerk/base/nsFileStreams.cpp rename : netwerk/base/src/nsFileStreams.h => netwerk/base/nsFileStreams.h rename : netwerk/base/public/nsIApplicationCache.idl => netwerk/base/nsIApplicationCache.idl rename : netwerk/base/public/nsIApplicationCacheChannel.idl => netwerk/base/nsIApplicationCacheChannel.idl rename : netwerk/base/public/nsIApplicationCacheContainer.idl => netwerk/base/nsIApplicationCacheContainer.idl rename : netwerk/base/public/nsIApplicationCacheService.idl => netwerk/base/nsIApplicationCacheService.idl rename : netwerk/base/public/nsIArrayBufferInputStream.idl => netwerk/base/nsIArrayBufferInputStream.idl rename : netwerk/base/public/nsIAsyncStreamCopier.idl => netwerk/base/nsIAsyncStreamCopier.idl rename : netwerk/base/public/nsIAsyncStreamCopier2.idl => netwerk/base/nsIAsyncStreamCopier2.idl rename : netwerk/base/public/nsIAsyncVerifyRedirectCallback.idl => netwerk/base/nsIAsyncVerifyRedirectCallback.idl rename : netwerk/base/public/nsIAuthInformation.idl => netwerk/base/nsIAuthInformation.idl rename : netwerk/base/public/nsIAuthModule.idl => netwerk/base/nsIAuthModule.idl rename : netwerk/base/public/nsIAuthPrompt.idl => netwerk/base/nsIAuthPrompt.idl rename : netwerk/base/public/nsIAuthPrompt2.idl => netwerk/base/nsIAuthPrompt2.idl rename : netwerk/base/public/nsIAuthPromptAdapterFactory.idl => netwerk/base/nsIAuthPromptAdapterFactory.idl rename : netwerk/base/public/nsIAuthPromptCallback.idl => netwerk/base/nsIAuthPromptCallback.idl rename : netwerk/base/public/nsIAuthPromptProvider.idl => netwerk/base/nsIAuthPromptProvider.idl rename : netwerk/base/public/nsIBackgroundFileSaver.idl => netwerk/base/nsIBackgroundFileSaver.idl rename : netwerk/base/public/nsIBrowserSearchService.idl => netwerk/base/nsIBrowserSearchService.idl rename : netwerk/base/public/nsIBufferedStreams.idl => netwerk/base/nsIBufferedStreams.idl rename : netwerk/base/public/nsIByteRangeRequest.idl => netwerk/base/nsIByteRangeRequest.idl rename : netwerk/base/public/nsICacheInfoChannel.idl => netwerk/base/nsICacheInfoChannel.idl rename : netwerk/base/public/nsICachingChannel.idl => netwerk/base/nsICachingChannel.idl rename : netwerk/base/public/nsICancelable.idl => netwerk/base/nsICancelable.idl rename : netwerk/base/public/nsIChannel.idl => netwerk/base/nsIChannel.idl rename : netwerk/base/public/nsIChannelEventSink.idl => netwerk/base/nsIChannelEventSink.idl rename : netwerk/base/public/nsIChildChannel.idl => netwerk/base/nsIChildChannel.idl rename : netwerk/base/public/nsIClassOfService.idl => netwerk/base/nsIClassOfService.idl rename : netwerk/base/public/nsIContentSniffer.idl => netwerk/base/nsIContentSniffer.idl rename : netwerk/base/public/nsICryptoFIPSInfo.idl => netwerk/base/nsICryptoFIPSInfo.idl rename : netwerk/base/public/nsICryptoHMAC.idl => netwerk/base/nsICryptoHMAC.idl rename : netwerk/base/public/nsICryptoHash.idl => netwerk/base/nsICryptoHash.idl rename : netwerk/base/public/nsIDashboard.idl => netwerk/base/nsIDashboard.idl rename : netwerk/base/public/nsIDashboardEventNotifier.idl => netwerk/base/nsIDashboardEventNotifier.idl rename : netwerk/base/public/nsIDivertableChannel.idl => netwerk/base/nsIDivertableChannel.idl rename : netwerk/base/public/nsIDownloader.idl => netwerk/base/nsIDownloader.idl rename : netwerk/base/public/nsIEncodedChannel.idl => netwerk/base/nsIEncodedChannel.idl rename : netwerk/base/public/nsIExternalProtocolHandler.idl => netwerk/base/nsIExternalProtocolHandler.idl rename : netwerk/base/public/nsIFileStreams.idl => netwerk/base/nsIFileStreams.idl rename : netwerk/base/public/nsIFileURL.idl => netwerk/base/nsIFileURL.idl rename : netwerk/base/public/nsIForcePendingChannel.idl => netwerk/base/nsIForcePendingChannel.idl rename : netwerk/base/public/nsIHttpPushListener.idl => netwerk/base/nsIHttpPushListener.idl rename : netwerk/base/public/nsIIOService.idl => netwerk/base/nsIIOService.idl rename : netwerk/base/public/nsIIOService2.idl => netwerk/base/nsIIOService2.idl rename : netwerk/base/public/nsIIncrementalDownload.idl => netwerk/base/nsIIncrementalDownload.idl rename : netwerk/base/public/nsIInputStreamChannel.idl => netwerk/base/nsIInputStreamChannel.idl rename : netwerk/base/public/nsIInputStreamPump.idl => netwerk/base/nsIInputStreamPump.idl rename : netwerk/base/public/nsILoadContextInfo.idl => netwerk/base/nsILoadContextInfo.idl rename : netwerk/base/public/nsILoadGroup.idl => netwerk/base/nsILoadGroup.idl rename : netwerk/base/public/nsILoadGroupChild.idl => netwerk/base/nsILoadGroupChild.idl rename : netwerk/base/public/nsIMIMEInputStream.idl => netwerk/base/nsIMIMEInputStream.idl rename : netwerk/base/public/nsIMultiPartChannel.idl => netwerk/base/nsIMultiPartChannel.idl rename : netwerk/base/public/nsINSSErrorsService.idl => netwerk/base/nsINSSErrorsService.idl rename : netwerk/base/public/nsINestedURI.idl => netwerk/base/nsINestedURI.idl rename : netwerk/base/public/nsINetAddr.idl => netwerk/base/nsINetAddr.idl rename : netwerk/base/public/nsINetUtil.idl => netwerk/base/nsINetUtil.idl rename : netwerk/base/public/nsINetworkInterceptController.idl => netwerk/base/nsINetworkInterceptController.idl rename : netwerk/base/public/nsINetworkLinkService.idl => netwerk/base/nsINetworkLinkService.idl rename : netwerk/base/public/nsINetworkPredictor.idl => netwerk/base/nsINetworkPredictor.idl rename : netwerk/base/public/nsINetworkPredictorVerifier.idl => netwerk/base/nsINetworkPredictorVerifier.idl rename : netwerk/base/public/nsINetworkProperties.idl => netwerk/base/nsINetworkProperties.idl rename : netwerk/base/public/nsINullChannel.idl => netwerk/base/nsINullChannel.idl rename : netwerk/base/src/nsIOService.cpp => netwerk/base/nsIOService.cpp rename : netwerk/base/src/nsIOService.h => netwerk/base/nsIOService.h rename : netwerk/base/public/nsIParentChannel.idl => netwerk/base/nsIParentChannel.idl rename : netwerk/base/public/nsIParentRedirectingChannel.idl => netwerk/base/nsIParentRedirectingChannel.idl rename : netwerk/base/public/nsIPermission.idl => netwerk/base/nsIPermission.idl rename : netwerk/base/public/nsIPermissionManager.idl => netwerk/base/nsIPermissionManager.idl rename : netwerk/base/public/nsIPrivateBrowsingChannel.idl => netwerk/base/nsIPrivateBrowsingChannel.idl rename : netwerk/base/public/nsIProgressEventSink.idl => netwerk/base/nsIProgressEventSink.idl rename : netwerk/base/public/nsIPrompt.idl => netwerk/base/nsIPrompt.idl rename : netwerk/base/public/nsIProtocolHandler.idl => netwerk/base/nsIProtocolHandler.idl rename : netwerk/base/public/nsIProtocolProxyCallback.idl => netwerk/base/nsIProtocolProxyCallback.idl rename : netwerk/base/public/nsIProtocolProxyFilter.idl => netwerk/base/nsIProtocolProxyFilter.idl rename : netwerk/base/public/nsIProtocolProxyService.idl => netwerk/base/nsIProtocolProxyService.idl rename : netwerk/base/public/nsIProtocolProxyService2.idl => netwerk/base/nsIProtocolProxyService2.idl rename : netwerk/base/public/nsIProxiedChannel.idl => netwerk/base/nsIProxiedChannel.idl rename : netwerk/base/public/nsIProxiedProtocolHandler.idl => netwerk/base/nsIProxiedProtocolHandler.idl rename : netwerk/base/public/nsIProxyInfo.idl => netwerk/base/nsIProxyInfo.idl rename : netwerk/base/public/nsIRandomGenerator.idl => netwerk/base/nsIRandomGenerator.idl rename : netwerk/base/public/nsIRedirectChannelRegistrar.idl => netwerk/base/nsIRedirectChannelRegistrar.idl rename : netwerk/base/public/nsIRedirectHistory.idl => netwerk/base/nsIRedirectHistory.idl rename : netwerk/base/public/nsIRedirectResultListener.idl => netwerk/base/nsIRedirectResultListener.idl rename : netwerk/base/public/nsIRequest.idl => netwerk/base/nsIRequest.idl rename : netwerk/base/public/nsIRequestObserver.idl => netwerk/base/nsIRequestObserver.idl rename : netwerk/base/public/nsIRequestObserverProxy.idl => netwerk/base/nsIRequestObserverProxy.idl rename : netwerk/base/public/nsIResumableChannel.idl => netwerk/base/nsIResumableChannel.idl rename : netwerk/base/public/nsISecretDecoderRing.idl => netwerk/base/nsISecretDecoderRing.idl rename : netwerk/base/public/nsISecureBrowserUI.idl => netwerk/base/nsISecureBrowserUI.idl rename : netwerk/base/public/nsISecurityEventSink.idl => netwerk/base/nsISecurityEventSink.idl rename : netwerk/base/public/nsISecurityInfoProvider.idl => netwerk/base/nsISecurityInfoProvider.idl rename : netwerk/base/public/nsISerializationHelper.idl => netwerk/base/nsISerializationHelper.idl rename : netwerk/base/public/nsIServerSocket.idl => netwerk/base/nsIServerSocket.idl rename : netwerk/base/public/nsISimpleStreamListener.idl => netwerk/base/nsISimpleStreamListener.idl rename : netwerk/base/public/nsISiteSecurityService.idl => netwerk/base/nsISiteSecurityService.idl rename : netwerk/base/public/nsISocketTransport.idl => netwerk/base/nsISocketTransport.idl rename : netwerk/base/public/nsISocketTransportService.idl => netwerk/base/nsISocketTransportService.idl rename : netwerk/base/public/nsISpeculativeConnect.idl => netwerk/base/nsISpeculativeConnect.idl rename : netwerk/base/public/nsIStandardURL.idl => netwerk/base/nsIStandardURL.idl rename : netwerk/base/public/nsIStreamListener.idl => netwerk/base/nsIStreamListener.idl rename : netwerk/base/public/nsIStreamListenerTee.idl => netwerk/base/nsIStreamListenerTee.idl rename : netwerk/base/public/nsIStreamLoader.idl => netwerk/base/nsIStreamLoader.idl rename : netwerk/base/public/nsIStreamTransportService.idl => netwerk/base/nsIStreamTransportService.idl rename : netwerk/base/public/nsIStreamingProtocolController.idl => netwerk/base/nsIStreamingProtocolController.idl rename : netwerk/base/public/nsIStreamingProtocolService.idl => netwerk/base/nsIStreamingProtocolService.idl rename : netwerk/base/public/nsISyncStreamListener.idl => netwerk/base/nsISyncStreamListener.idl rename : netwerk/base/public/nsISystemProxySettings.idl => netwerk/base/nsISystemProxySettings.idl rename : netwerk/base/public/nsITLSServerSocket.idl => netwerk/base/nsITLSServerSocket.idl rename : netwerk/base/public/nsIThreadRetargetableRequest.idl => netwerk/base/nsIThreadRetargetableRequest.idl rename : netwerk/base/public/nsIThreadRetargetableStreamListener.idl => netwerk/base/nsIThreadRetargetableStreamListener.idl rename : netwerk/base/public/nsITimedChannel.idl => netwerk/base/nsITimedChannel.idl rename : netwerk/base/public/nsITraceableChannel.idl => netwerk/base/nsITraceableChannel.idl rename : netwerk/base/public/nsITransport.idl => netwerk/base/nsITransport.idl rename : netwerk/base/public/nsIUDPSocket.idl => netwerk/base/nsIUDPSocket.idl rename : netwerk/base/public/nsIUDPSocketFilter.idl => netwerk/base/nsIUDPSocketFilter.idl rename : netwerk/base/public/nsIURI.idl => netwerk/base/nsIURI.idl rename : netwerk/base/public/nsIURIChecker.idl => netwerk/base/nsIURIChecker.idl rename : netwerk/base/public/nsIURIClassifier.idl => netwerk/base/nsIURIClassifier.idl rename : netwerk/base/public/nsIURIWithPrincipal.idl => netwerk/base/nsIURIWithPrincipal.idl rename : netwerk/base/public/nsIURL.idl => netwerk/base/nsIURL.idl rename : netwerk/base/public/nsIURLParser.idl => netwerk/base/nsIURLParser.idl rename : netwerk/base/public/nsIUnicharStreamLoader.idl => netwerk/base/nsIUnicharStreamLoader.idl rename : netwerk/base/public/nsIUploadChannel.idl => netwerk/base/nsIUploadChannel.idl rename : netwerk/base/public/nsIUploadChannel2.idl => netwerk/base/nsIUploadChannel2.idl rename : netwerk/base/src/nsIncrementalDownload.cpp => netwerk/base/nsIncrementalDownload.cpp rename : netwerk/base/src/nsInputStreamChannel.cpp => netwerk/base/nsInputStreamChannel.cpp rename : netwerk/base/src/nsInputStreamChannel.h => netwerk/base/nsInputStreamChannel.h rename : netwerk/base/src/nsInputStreamPump.cpp => netwerk/base/nsInputStreamPump.cpp rename : netwerk/base/src/nsInputStreamPump.h => netwerk/base/nsInputStreamPump.h rename : netwerk/base/src/nsLoadGroup.cpp => netwerk/base/nsLoadGroup.cpp rename : netwerk/base/src/nsLoadGroup.h => netwerk/base/nsLoadGroup.h rename : netwerk/base/src/nsMIMEInputStream.cpp => netwerk/base/nsMIMEInputStream.cpp rename : netwerk/base/src/nsMIMEInputStream.h => netwerk/base/nsMIMEInputStream.h rename : netwerk/base/src/nsMediaFragmentURIParser.cpp => netwerk/base/nsMediaFragmentURIParser.cpp rename : netwerk/base/src/nsMediaFragmentURIParser.h => netwerk/base/nsMediaFragmentURIParser.h rename : netwerk/base/src/nsNativeConnectionHelper.cpp => netwerk/base/nsNativeConnectionHelper.cpp rename : netwerk/base/src/nsNativeConnectionHelper.h => netwerk/base/nsNativeConnectionHelper.h rename : netwerk/base/src/nsNetAddr.cpp => netwerk/base/nsNetAddr.cpp rename : netwerk/base/src/nsNetAddr.h => netwerk/base/nsNetAddr.h rename : netwerk/base/src/nsNetSegmentUtils.h => netwerk/base/nsNetSegmentUtils.h rename : netwerk/base/src/nsNetUtil.cpp => netwerk/base/nsNetUtil.cpp rename : netwerk/base/public/nsNetUtil.h => netwerk/base/nsNetUtil.h rename : netwerk/base/src/nsPACMan.cpp => netwerk/base/nsPACMan.cpp rename : netwerk/base/src/nsPACMan.h => netwerk/base/nsPACMan.h rename : netwerk/base/public/nsPILoadGroupInternal.idl => netwerk/base/nsPILoadGroupInternal.idl rename : netwerk/base/public/nsPISocketTransportService.idl => netwerk/base/nsPISocketTransportService.idl rename : netwerk/base/src/nsPreloadedStream.cpp => netwerk/base/nsPreloadedStream.cpp rename : netwerk/base/src/nsPreloadedStream.h => netwerk/base/nsPreloadedStream.h rename : netwerk/base/src/nsProtocolProxyService.cpp => netwerk/base/nsProtocolProxyService.cpp rename : netwerk/base/src/nsProtocolProxyService.h => netwerk/base/nsProtocolProxyService.h rename : netwerk/base/src/nsProxyInfo.cpp => netwerk/base/nsProxyInfo.cpp rename : netwerk/base/src/nsProxyInfo.h => netwerk/base/nsProxyInfo.h rename : netwerk/base/public/nsReadLine.h => netwerk/base/nsReadLine.h rename : netwerk/base/src/nsRequestObserverProxy.cpp => netwerk/base/nsRequestObserverProxy.cpp rename : netwerk/base/src/nsRequestObserverProxy.h => netwerk/base/nsRequestObserverProxy.h rename : netwerk/base/src/nsSerializationHelper.cpp => netwerk/base/nsSerializationHelper.cpp rename : netwerk/base/src/nsSerializationHelper.h => netwerk/base/nsSerializationHelper.h rename : netwerk/base/src/nsServerSocket.cpp => netwerk/base/nsServerSocket.cpp rename : netwerk/base/src/nsServerSocket.h => netwerk/base/nsServerSocket.h rename : netwerk/base/src/nsSimpleNestedURI.cpp => netwerk/base/nsSimpleNestedURI.cpp rename : netwerk/base/src/nsSimpleNestedURI.h => netwerk/base/nsSimpleNestedURI.h rename : netwerk/base/src/nsSimpleStreamListener.cpp => netwerk/base/nsSimpleStreamListener.cpp rename : netwerk/base/src/nsSimpleStreamListener.h => netwerk/base/nsSimpleStreamListener.h rename : netwerk/base/src/nsSimpleURI.cpp => netwerk/base/nsSimpleURI.cpp rename : netwerk/base/src/nsSimpleURI.h => netwerk/base/nsSimpleURI.h rename : netwerk/base/src/nsSocketTransport2.cpp => netwerk/base/nsSocketTransport2.cpp rename : netwerk/base/src/nsSocketTransport2.h => netwerk/base/nsSocketTransport2.h rename : netwerk/base/src/nsSocketTransportService2.cpp => netwerk/base/nsSocketTransportService2.cpp rename : netwerk/base/src/nsSocketTransportService2.h => netwerk/base/nsSocketTransportService2.h rename : netwerk/base/src/nsStandardURL.cpp => netwerk/base/nsStandardURL.cpp rename : netwerk/base/src/nsStandardURL.h => netwerk/base/nsStandardURL.h rename : netwerk/base/src/nsStreamListenerTee.cpp => netwerk/base/nsStreamListenerTee.cpp rename : netwerk/base/src/nsStreamListenerTee.h => netwerk/base/nsStreamListenerTee.h rename : netwerk/base/src/nsStreamListenerWrapper.cpp => netwerk/base/nsStreamListenerWrapper.cpp rename : netwerk/base/public/nsStreamListenerWrapper.h => netwerk/base/nsStreamListenerWrapper.h rename : netwerk/base/src/nsStreamLoader.cpp => netwerk/base/nsStreamLoader.cpp rename : netwerk/base/src/nsStreamLoader.h => netwerk/base/nsStreamLoader.h rename : netwerk/base/src/nsStreamTransportService.cpp => netwerk/base/nsStreamTransportService.cpp rename : netwerk/base/src/nsStreamTransportService.h => netwerk/base/nsStreamTransportService.h rename : netwerk/base/src/nsSyncStreamListener.cpp => netwerk/base/nsSyncStreamListener.cpp rename : netwerk/base/src/nsSyncStreamListener.h => netwerk/base/nsSyncStreamListener.h rename : netwerk/base/src/nsTemporaryFileInputStream.cpp => netwerk/base/nsTemporaryFileInputStream.cpp rename : netwerk/base/src/nsTemporaryFileInputStream.h => netwerk/base/nsTemporaryFileInputStream.h rename : netwerk/base/src/nsTransportUtils.cpp => netwerk/base/nsTransportUtils.cpp rename : netwerk/base/src/nsTransportUtils.h => netwerk/base/nsTransportUtils.h rename : netwerk/base/src/nsUDPSocket.cpp => netwerk/base/nsUDPSocket.cpp rename : netwerk/base/src/nsUDPSocket.h => netwerk/base/nsUDPSocket.h rename : netwerk/base/src/nsURIChecker.cpp => netwerk/base/nsURIChecker.cpp rename : netwerk/base/src/nsURIChecker.h => netwerk/base/nsURIChecker.h rename : netwerk/base/public/nsURIHashKey.h => netwerk/base/nsURIHashKey.h rename : netwerk/base/src/nsURLHelper.cpp => netwerk/base/nsURLHelper.cpp rename : netwerk/base/src/nsURLHelper.h => netwerk/base/nsURLHelper.h rename : netwerk/base/src/nsURLHelperOSX.cpp => netwerk/base/nsURLHelperOSX.cpp rename : netwerk/base/src/nsURLHelperUnix.cpp => netwerk/base/nsURLHelperUnix.cpp rename : netwerk/base/src/nsURLHelperWin.cpp => netwerk/base/nsURLHelperWin.cpp rename : netwerk/base/src/nsURLParsers.cpp => netwerk/base/nsURLParsers.cpp rename : netwerk/base/src/nsURLParsers.h => netwerk/base/nsURLParsers.h rename : netwerk/base/src/nsUnicharStreamLoader.cpp => netwerk/base/nsUnicharStreamLoader.cpp rename : netwerk/base/src/nsUnicharStreamLoader.h => netwerk/base/nsUnicharStreamLoader.h rename : netwerk/base/public/security-prefs.js => netwerk/base/security-prefs.js extra : rebase_source : 1c3a3af5609aceeb11b12604aeda6f864fbcd5e0
930 lines
26 KiB
C++
930 lines
26 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "nsIIncrementalDownload.h"
|
|
#include "nsIRequestObserver.h"
|
|
#include "nsIProgressEventSink.h"
|
|
#include "nsIChannelEventSink.h"
|
|
#include "nsIAsyncVerifyRedirectCallback.h"
|
|
#include "nsIInterfaceRequestor.h"
|
|
#include "nsIObserverService.h"
|
|
#include "nsIObserver.h"
|
|
#include "nsIFile.h"
|
|
#include "nsITimer.h"
|
|
#include "nsNetUtil.h"
|
|
#include "nsAutoPtr.h"
|
|
#include "nsWeakReference.h"
|
|
#include "prio.h"
|
|
#include "prprf.h"
|
|
#include <algorithm>
|
|
#include "nsIContentPolicy.h"
|
|
#include "nsContentUtils.h"
|
|
|
|
// Default values used to initialize a nsIncrementalDownload object.
|
|
#define DEFAULT_CHUNK_SIZE (4096 * 16) // bytes
|
|
#define DEFAULT_INTERVAL 60 // seconds
|
|
|
|
#define UPDATE_PROGRESS_INTERVAL PRTime(500 * PR_USEC_PER_MSEC) // 500ms
|
|
|
|
// Number of times to retry a failed byte-range request.
|
|
#define MAX_RETRY_COUNT 20
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
static nsresult
|
|
WriteToFile(nsIFile *lf, const char *data, uint32_t len, int32_t flags)
|
|
{
|
|
PRFileDesc *fd;
|
|
int32_t mode = 0600;
|
|
nsresult rv;
|
|
#if defined(MOZ_WIDGET_GONK)
|
|
// The sdcard on a B2G phone looks like:
|
|
// d---rwx--- system sdcard_rw 1970-01-01 01:00:00 sdcard
|
|
// On the emulator, xpcshell fails when using 0600 mode to open the file,
|
|
// and 0660 works.
|
|
nsCOMPtr<nsIFile> parent;
|
|
rv = lf->GetParent(getter_AddRefs(parent));
|
|
if (NS_FAILED(rv)) {
|
|
return rv;
|
|
}
|
|
uint32_t parentPerm;
|
|
rv = parent->GetPermissions(&parentPerm);
|
|
if (NS_FAILED(rv)) {
|
|
return rv;
|
|
}
|
|
if ((parentPerm & 0700) == 0) {
|
|
// Parent directory has no owner-write, so try to use group permissions
|
|
// instead of owner permissions.
|
|
mode = 0660;
|
|
}
|
|
#endif
|
|
rv = lf->OpenNSPRFileDesc(flags, mode, &fd);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
if (len)
|
|
rv = PR_Write(fd, data, len) == int32_t(len) ? NS_OK : NS_ERROR_FAILURE;
|
|
|
|
PR_Close(fd);
|
|
return rv;
|
|
}
|
|
|
|
static nsresult
|
|
AppendToFile(nsIFile *lf, const char *data, uint32_t len)
|
|
{
|
|
int32_t flags = PR_WRONLY | PR_CREATE_FILE | PR_APPEND;
|
|
return WriteToFile(lf, data, len, flags);
|
|
}
|
|
|
|
// maxSize may be -1 if unknown
|
|
static void
|
|
MakeRangeSpec(const int64_t &size, const int64_t &maxSize, int32_t chunkSize,
|
|
bool fetchRemaining, nsCString &rangeSpec)
|
|
{
|
|
rangeSpec.AssignLiteral("bytes=");
|
|
rangeSpec.AppendInt(int64_t(size));
|
|
rangeSpec.Append('-');
|
|
|
|
if (fetchRemaining)
|
|
return;
|
|
|
|
int64_t end = size + int64_t(chunkSize);
|
|
if (maxSize != int64_t(-1) && end > maxSize)
|
|
end = maxSize;
|
|
end -= 1;
|
|
|
|
rangeSpec.AppendInt(int64_t(end));
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class nsIncrementalDownload MOZ_FINAL
|
|
: public nsIIncrementalDownload
|
|
, public nsIStreamListener
|
|
, public nsIObserver
|
|
, public nsIInterfaceRequestor
|
|
, public nsIChannelEventSink
|
|
, public nsSupportsWeakReference
|
|
, public nsIAsyncVerifyRedirectCallback
|
|
{
|
|
public:
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSIREQUEST
|
|
NS_DECL_NSIINCREMENTALDOWNLOAD
|
|
NS_DECL_NSIREQUESTOBSERVER
|
|
NS_DECL_NSISTREAMLISTENER
|
|
NS_DECL_NSIOBSERVER
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
NS_DECL_NSICHANNELEVENTSINK
|
|
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
|
|
|
|
nsIncrementalDownload();
|
|
|
|
private:
|
|
~nsIncrementalDownload() {}
|
|
nsresult FlushChunk();
|
|
void UpdateProgress();
|
|
nsresult CallOnStartRequest();
|
|
void CallOnStopRequest();
|
|
nsresult StartTimer(int32_t interval);
|
|
nsresult ProcessTimeout();
|
|
nsresult ReadCurrentSize();
|
|
nsresult ClearRequestHeader(nsIHttpChannel *channel);
|
|
|
|
nsCOMPtr<nsIRequestObserver> mObserver;
|
|
nsCOMPtr<nsISupports> mObserverContext;
|
|
nsCOMPtr<nsIProgressEventSink> mProgressSink;
|
|
nsCOMPtr<nsIURI> mURI;
|
|
nsCOMPtr<nsIURI> mFinalURI;
|
|
nsCOMPtr<nsIFile> mDest;
|
|
nsCOMPtr<nsIChannel> mChannel;
|
|
nsCOMPtr<nsITimer> mTimer;
|
|
nsAutoArrayPtr<char> mChunk;
|
|
int32_t mChunkLen;
|
|
int32_t mChunkSize;
|
|
int32_t mInterval;
|
|
int64_t mTotalSize;
|
|
int64_t mCurrentSize;
|
|
uint32_t mLoadFlags;
|
|
int32_t mNonPartialCount;
|
|
nsresult mStatus;
|
|
bool mIsPending;
|
|
bool mDidOnStartRequest;
|
|
PRTime mLastProgressUpdate;
|
|
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
|
|
nsCOMPtr<nsIChannel> mNewRedirectChannel;
|
|
nsCString mPartialValidator;
|
|
bool mCacheBust;
|
|
};
|
|
|
|
nsIncrementalDownload::nsIncrementalDownload()
|
|
: mChunkLen(0)
|
|
, mChunkSize(DEFAULT_CHUNK_SIZE)
|
|
, mInterval(DEFAULT_INTERVAL)
|
|
, mTotalSize(-1)
|
|
, mCurrentSize(-1)
|
|
, mLoadFlags(LOAD_NORMAL)
|
|
, mNonPartialCount(0)
|
|
, mStatus(NS_OK)
|
|
, mIsPending(false)
|
|
, mDidOnStartRequest(false)
|
|
, mLastProgressUpdate(0)
|
|
, mRedirectCallback(nullptr)
|
|
, mNewRedirectChannel(nullptr)
|
|
, mCacheBust(false)
|
|
{
|
|
}
|
|
|
|
nsresult
|
|
nsIncrementalDownload::FlushChunk()
|
|
{
|
|
NS_ASSERTION(mTotalSize != int64_t(-1), "total size should be known");
|
|
|
|
if (mChunkLen == 0)
|
|
return NS_OK;
|
|
|
|
nsresult rv = AppendToFile(mDest, mChunk, mChunkLen);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
mCurrentSize += int64_t(mChunkLen);
|
|
mChunkLen = 0;
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
nsIncrementalDownload::UpdateProgress()
|
|
{
|
|
mLastProgressUpdate = PR_Now();
|
|
|
|
if (mProgressSink)
|
|
mProgressSink->OnProgress(this, mObserverContext,
|
|
mCurrentSize + mChunkLen,
|
|
mTotalSize);
|
|
}
|
|
|
|
nsresult
|
|
nsIncrementalDownload::CallOnStartRequest()
|
|
{
|
|
if (!mObserver || mDidOnStartRequest)
|
|
return NS_OK;
|
|
|
|
mDidOnStartRequest = true;
|
|
return mObserver->OnStartRequest(this, mObserverContext);
|
|
}
|
|
|
|
void
|
|
nsIncrementalDownload::CallOnStopRequest()
|
|
{
|
|
if (!mObserver)
|
|
return;
|
|
|
|
// Ensure that OnStartRequest is always called once before OnStopRequest.
|
|
nsresult rv = CallOnStartRequest();
|
|
if (NS_SUCCEEDED(mStatus))
|
|
mStatus = rv;
|
|
|
|
mIsPending = false;
|
|
|
|
mObserver->OnStopRequest(this, mObserverContext, mStatus);
|
|
mObserver = nullptr;
|
|
mObserverContext = nullptr;
|
|
}
|
|
|
|
nsresult
|
|
nsIncrementalDownload::StartTimer(int32_t interval)
|
|
{
|
|
nsresult rv;
|
|
mTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
return mTimer->Init(this, interval * 1000, nsITimer::TYPE_ONE_SHOT);
|
|
}
|
|
|
|
nsresult
|
|
nsIncrementalDownload::ProcessTimeout()
|
|
{
|
|
NS_ASSERTION(!mChannel, "how can we have a channel?");
|
|
|
|
// Handle existing error conditions
|
|
if (NS_FAILED(mStatus)) {
|
|
CallOnStopRequest();
|
|
return NS_OK;
|
|
}
|
|
|
|
// Fetch next chunk
|
|
|
|
nsCOMPtr<nsIChannel> channel;
|
|
nsresult rv = NS_NewChannel(getter_AddRefs(channel),
|
|
mFinalURI,
|
|
nsContentUtils::GetSystemPrincipal(),
|
|
nsILoadInfo::SEC_NORMAL,
|
|
nsIContentPolicy::TYPE_OTHER,
|
|
nullptr, // loadGroup
|
|
this, // aCallbacks
|
|
mLoadFlags);
|
|
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(channel, &rv);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
NS_ASSERTION(mCurrentSize != int64_t(-1),
|
|
"we should know the current file size by now");
|
|
|
|
rv = ClearRequestHeader(http);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
// Don't bother making a range request if we are just going to fetch the
|
|
// entire document.
|
|
if (mInterval || mCurrentSize != int64_t(0)) {
|
|
nsAutoCString range;
|
|
MakeRangeSpec(mCurrentSize, mTotalSize, mChunkSize, mInterval == 0, range);
|
|
|
|
rv = http->SetRequestHeader(NS_LITERAL_CSTRING("Range"), range, false);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
if (!mPartialValidator.IsEmpty())
|
|
http->SetRequestHeader(NS_LITERAL_CSTRING("If-Range"),
|
|
mPartialValidator, false);
|
|
|
|
if (mCacheBust) {
|
|
http->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
|
|
NS_LITERAL_CSTRING("no-cache"), false);
|
|
http->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"),
|
|
NS_LITERAL_CSTRING("no-cache"), false);
|
|
}
|
|
}
|
|
|
|
rv = channel->AsyncOpen(this, nullptr);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
// Wait to assign mChannel when we know we are going to succeed. This is
|
|
// important because we don't want to introduce a reference cycle between
|
|
// mChannel and this until we know for a fact that AsyncOpen has succeeded,
|
|
// thus ensuring that our stream listener methods will be invoked.
|
|
mChannel = channel;
|
|
return NS_OK;
|
|
}
|
|
|
|
// Reads the current file size and validates it.
|
|
nsresult
|
|
nsIncrementalDownload::ReadCurrentSize()
|
|
{
|
|
int64_t size;
|
|
nsresult rv = mDest->GetFileSize((int64_t *) &size);
|
|
if (rv == NS_ERROR_FILE_NOT_FOUND ||
|
|
rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
|
|
mCurrentSize = 0;
|
|
return NS_OK;
|
|
}
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
mCurrentSize = size;
|
|
return NS_OK;
|
|
}
|
|
|
|
// nsISupports
|
|
|
|
NS_IMPL_ISUPPORTS(nsIncrementalDownload,
|
|
nsIIncrementalDownload,
|
|
nsIRequest,
|
|
nsIStreamListener,
|
|
nsIRequestObserver,
|
|
nsIObserver,
|
|
nsIInterfaceRequestor,
|
|
nsIChannelEventSink,
|
|
nsISupportsWeakReference,
|
|
nsIAsyncVerifyRedirectCallback)
|
|
|
|
// nsIRequest
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetName(nsACString &name)
|
|
{
|
|
NS_ENSURE_TRUE(mURI, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
return mURI->GetSpec(name);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::IsPending(bool *isPending)
|
|
{
|
|
*isPending = mIsPending;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetStatus(nsresult *status)
|
|
{
|
|
*status = mStatus;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::Cancel(nsresult status)
|
|
{
|
|
NS_ENSURE_ARG(NS_FAILED(status));
|
|
|
|
// Ignore this cancelation if we're already canceled.
|
|
if (NS_FAILED(mStatus))
|
|
return NS_OK;
|
|
|
|
mStatus = status;
|
|
|
|
// Nothing more to do if callbacks aren't pending.
|
|
if (!mIsPending)
|
|
return NS_OK;
|
|
|
|
if (mChannel) {
|
|
mChannel->Cancel(mStatus);
|
|
NS_ASSERTION(!mTimer, "what is this timer object doing here?");
|
|
}
|
|
else {
|
|
// dispatch a timer callback event to drive invoking our listener's
|
|
// OnStopRequest.
|
|
if (mTimer)
|
|
mTimer->Cancel();
|
|
StartTimer(0);
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::Suspend()
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::Resume()
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetLoadFlags(nsLoadFlags *loadFlags)
|
|
{
|
|
*loadFlags = mLoadFlags;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::SetLoadFlags(nsLoadFlags loadFlags)
|
|
{
|
|
mLoadFlags = loadFlags;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetLoadGroup(nsILoadGroup **loadGroup)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::SetLoadGroup(nsILoadGroup *loadGroup)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
// nsIIncrementalDownload
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::Init(nsIURI *uri, nsIFile *dest,
|
|
int32_t chunkSize, int32_t interval)
|
|
{
|
|
// Keep it simple: only allow initialization once
|
|
NS_ENSURE_FALSE(mURI, NS_ERROR_ALREADY_INITIALIZED);
|
|
|
|
mDest = do_QueryInterface(dest);
|
|
NS_ENSURE_ARG(mDest);
|
|
|
|
mURI = uri;
|
|
mFinalURI = uri;
|
|
|
|
if (chunkSize > 0)
|
|
mChunkSize = chunkSize;
|
|
if (interval >= 0)
|
|
mInterval = interval;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetURI(nsIURI **result)
|
|
{
|
|
NS_IF_ADDREF(*result = mURI);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetFinalURI(nsIURI **result)
|
|
{
|
|
NS_IF_ADDREF(*result = mFinalURI);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetDestination(nsIFile **result)
|
|
{
|
|
if (!mDest) {
|
|
*result = nullptr;
|
|
return NS_OK;
|
|
}
|
|
// Return a clone of mDest so that callers may modify the resulting nsIFile
|
|
// without corrupting our internal object. This also works around the fact
|
|
// that some nsIFile impls may cache the result of stat'ing the filesystem.
|
|
return mDest->Clone(result);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetTotalSize(int64_t *result)
|
|
{
|
|
*result = mTotalSize;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetCurrentSize(int64_t *result)
|
|
{
|
|
*result = mCurrentSize;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::Start(nsIRequestObserver *observer,
|
|
nsISupports *context)
|
|
{
|
|
NS_ENSURE_ARG(observer);
|
|
NS_ENSURE_FALSE(mIsPending, NS_ERROR_IN_PROGRESS);
|
|
|
|
// Observe system shutdown so we can be sure to release any reference held
|
|
// between ourselves and the timer. We have the observer service hold a weak
|
|
// reference to us, so that we don't have to worry about calling
|
|
// RemoveObserver. XXX(darin): The timer code should do this for us.
|
|
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
|
if (obs)
|
|
obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
|
|
|
|
nsresult rv = ReadCurrentSize();
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
rv = StartTimer(0);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
mObserver = observer;
|
|
mObserverContext = context;
|
|
mProgressSink = do_QueryInterface(observer); // ok if null
|
|
|
|
mIsPending = true;
|
|
return NS_OK;
|
|
}
|
|
|
|
// nsIRequestObserver
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::OnStartRequest(nsIRequest *request,
|
|
nsISupports *context)
|
|
{
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(request, &rv);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
// Ensure that we are receiving a 206 response.
|
|
uint32_t code;
|
|
rv = http->GetResponseStatus(&code);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
if (code != 206) {
|
|
// We may already have the entire file downloaded, in which case
|
|
// our request for a range beyond the end of the file would have
|
|
// been met with an error response code.
|
|
if (code == 416 && mTotalSize == int64_t(-1)) {
|
|
mTotalSize = mCurrentSize;
|
|
// Return an error code here to suppress OnDataAvailable.
|
|
return NS_ERROR_DOWNLOAD_COMPLETE;
|
|
}
|
|
// The server may have decided to give us all of the data in one chunk. If
|
|
// we requested a partial range, then we don't want to download all of the
|
|
// data at once. So, we'll just try again, but if this keeps happening then
|
|
// we'll eventually give up.
|
|
if (code == 200) {
|
|
if (mInterval) {
|
|
mChannel = nullptr;
|
|
if (++mNonPartialCount > MAX_RETRY_COUNT) {
|
|
NS_WARNING("unable to fetch a byte range; giving up");
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
// Increase delay with each failure.
|
|
StartTimer(mInterval * mNonPartialCount);
|
|
return NS_ERROR_DOWNLOAD_NOT_PARTIAL;
|
|
}
|
|
// Since we have been asked to download the rest of the file, we can deal
|
|
// with a 200 response. This may result in downloading the beginning of
|
|
// the file again, but that can't really be helped.
|
|
} else {
|
|
NS_WARNING("server response was unexpected");
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
} else {
|
|
// We got a partial response, so clear this counter in case the next chunk
|
|
// results in a 200 response.
|
|
mNonPartialCount = 0;
|
|
|
|
// confirm that the content-range response header is consistent with
|
|
// expectations on each 206. If it is not then drop this response and
|
|
// retry with no-cache set.
|
|
if (!mCacheBust) {
|
|
nsAutoCString buf;
|
|
int64_t startByte = 0;
|
|
bool confirmedOK = false;
|
|
|
|
rv = http->GetResponseHeader(NS_LITERAL_CSTRING("Content-Range"), buf);
|
|
if (NS_FAILED(rv))
|
|
return rv; // it isn't a useful 206 without a CONTENT-RANGE of some sort
|
|
|
|
// Content-Range: bytes 0-299999/25604694
|
|
int32_t p = buf.Find("bytes ");
|
|
|
|
// first look for the starting point of the content-range
|
|
// to make sure it is what we expect
|
|
if (p != -1) {
|
|
char *endptr = nullptr;
|
|
const char *s = buf.get() + p + 6;
|
|
while (*s && *s == ' ')
|
|
s++;
|
|
startByte = strtol(s, &endptr, 10);
|
|
|
|
if (*s && endptr && (endptr != s) &&
|
|
(mCurrentSize == startByte)) {
|
|
|
|
// ok the starting point is confirmed. We still need to check the
|
|
// total size of the range for consistency if this isn't
|
|
// the first chunk
|
|
if (mTotalSize == int64_t(-1)) {
|
|
// first chunk
|
|
confirmedOK = true;
|
|
} else {
|
|
int32_t slash = buf.FindChar('/');
|
|
int64_t rangeSize = 0;
|
|
if (slash != kNotFound &&
|
|
(PR_sscanf(buf.get() + slash + 1, "%lld", (int64_t *) &rangeSize) == 1) &&
|
|
rangeSize == mTotalSize) {
|
|
confirmedOK = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!confirmedOK) {
|
|
NS_WARNING("unexpected content-range");
|
|
mCacheBust = true;
|
|
mChannel = nullptr;
|
|
if (++mNonPartialCount > MAX_RETRY_COUNT) {
|
|
NS_WARNING("unable to fetch a byte range; giving up");
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
// Increase delay with each failure.
|
|
StartTimer(mInterval * mNonPartialCount);
|
|
return NS_ERROR_DOWNLOAD_NOT_PARTIAL;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Do special processing after the first response.
|
|
if (mTotalSize == int64_t(-1)) {
|
|
// Update knowledge of mFinalURI
|
|
rv = http->GetURI(getter_AddRefs(mFinalURI));
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
http->GetResponseHeader(NS_LITERAL_CSTRING("Etag"), mPartialValidator);
|
|
if (StringBeginsWith(mPartialValidator, NS_LITERAL_CSTRING("W/")))
|
|
mPartialValidator.Truncate(); // don't use weak validators
|
|
if (mPartialValidator.IsEmpty())
|
|
http->GetResponseHeader(NS_LITERAL_CSTRING("Last-Modified"), mPartialValidator);
|
|
|
|
if (code == 206) {
|
|
// OK, read the Content-Range header to determine the total size of this
|
|
// download file.
|
|
nsAutoCString buf;
|
|
rv = http->GetResponseHeader(NS_LITERAL_CSTRING("Content-Range"), buf);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
int32_t slash = buf.FindChar('/');
|
|
if (slash == kNotFound) {
|
|
NS_WARNING("server returned invalid Content-Range header!");
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
if (PR_sscanf(buf.get() + slash + 1, "%lld", (int64_t *) &mTotalSize) != 1)
|
|
return NS_ERROR_UNEXPECTED;
|
|
} else {
|
|
rv = http->GetContentLength(&mTotalSize);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
// We need to know the total size of the thing we're trying to download.
|
|
if (mTotalSize == int64_t(-1)) {
|
|
NS_WARNING("server returned no content-length header!");
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
// Need to truncate (or create, if it doesn't exist) the file since we
|
|
// are downloading the whole thing.
|
|
WriteToFile(mDest, nullptr, 0, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE);
|
|
mCurrentSize = 0;
|
|
}
|
|
|
|
// Notify observer that we are starting...
|
|
rv = CallOnStartRequest();
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
}
|
|
|
|
// Adjust mChunkSize accordingly if mCurrentSize is close to mTotalSize.
|
|
int64_t diff = mTotalSize - mCurrentSize;
|
|
if (diff <= int64_t(0)) {
|
|
NS_WARNING("about to set a bogus chunk size; giving up");
|
|
return NS_ERROR_UNEXPECTED;
|
|
}
|
|
|
|
if (diff < int64_t(mChunkSize))
|
|
mChunkSize = uint32_t(diff);
|
|
|
|
mChunk = new char[mChunkSize];
|
|
if (!mChunk)
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::OnStopRequest(nsIRequest *request,
|
|
nsISupports *context,
|
|
nsresult status)
|
|
{
|
|
// Not a real error; just a trick to kill off the channel without our
|
|
// listener having to care.
|
|
if (status == NS_ERROR_DOWNLOAD_NOT_PARTIAL)
|
|
return NS_OK;
|
|
|
|
// Not a real error; just a trick used to suppress OnDataAvailable calls.
|
|
if (status == NS_ERROR_DOWNLOAD_COMPLETE)
|
|
status = NS_OK;
|
|
|
|
if (NS_SUCCEEDED(mStatus))
|
|
mStatus = status;
|
|
|
|
if (mChunk) {
|
|
if (NS_SUCCEEDED(mStatus))
|
|
mStatus = FlushChunk();
|
|
|
|
mChunk = nullptr; // deletes memory
|
|
mChunkLen = 0;
|
|
UpdateProgress();
|
|
}
|
|
|
|
mChannel = nullptr;
|
|
|
|
// Notify listener if we hit an error or finished
|
|
if (NS_FAILED(mStatus) || mCurrentSize == mTotalSize) {
|
|
CallOnStopRequest();
|
|
return NS_OK;
|
|
}
|
|
|
|
return StartTimer(mInterval); // Do next chunk
|
|
}
|
|
|
|
// nsIStreamListener
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::OnDataAvailable(nsIRequest *request,
|
|
nsISupports *context,
|
|
nsIInputStream *input,
|
|
uint64_t offset,
|
|
uint32_t count)
|
|
{
|
|
while (count) {
|
|
uint32_t space = mChunkSize - mChunkLen;
|
|
uint32_t n, len = std::min(space, count);
|
|
|
|
nsresult rv = input->Read(mChunk + mChunkLen, len, &n);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
if (n != len)
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
count -= n;
|
|
mChunkLen += n;
|
|
|
|
if (mChunkLen == mChunkSize) {
|
|
rv = FlushChunk();
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
}
|
|
}
|
|
|
|
if (PR_Now() > mLastProgressUpdate + UPDATE_PROGRESS_INTERVAL)
|
|
UpdateProgress();
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
// nsIObserver
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::Observe(nsISupports *subject, const char *topic,
|
|
const char16_t *data)
|
|
{
|
|
if (strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
|
|
Cancel(NS_ERROR_ABORT);
|
|
|
|
// Since the app is shutting down, we need to go ahead and notify our
|
|
// observer here. Otherwise, we would notify them after XPCOM has been
|
|
// shutdown or not at all.
|
|
CallOnStopRequest();
|
|
}
|
|
else if (strcmp(topic, NS_TIMER_CALLBACK_TOPIC) == 0) {
|
|
mTimer = nullptr;
|
|
nsresult rv = ProcessTimeout();
|
|
if (NS_FAILED(rv))
|
|
Cancel(rv);
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
// nsIInterfaceRequestor
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::GetInterface(const nsIID &iid, void **result)
|
|
{
|
|
if (iid.Equals(NS_GET_IID(nsIChannelEventSink))) {
|
|
NS_ADDREF_THIS();
|
|
*result = static_cast<nsIChannelEventSink *>(this);
|
|
return NS_OK;
|
|
}
|
|
|
|
nsCOMPtr<nsIInterfaceRequestor> ir = do_QueryInterface(mObserver);
|
|
if (ir)
|
|
return ir->GetInterface(iid, result);
|
|
|
|
return NS_ERROR_NO_INTERFACE;
|
|
}
|
|
|
|
nsresult
|
|
nsIncrementalDownload::ClearRequestHeader(nsIHttpChannel *channel)
|
|
{
|
|
NS_ENSURE_ARG(channel);
|
|
|
|
// We don't support encodings -- they make the Content-Length not equal
|
|
// to the actual size of the data.
|
|
return channel->SetRequestHeader(NS_LITERAL_CSTRING("Accept-Encoding"),
|
|
NS_LITERAL_CSTRING(""), false);
|
|
}
|
|
|
|
// nsIChannelEventSink
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::AsyncOnChannelRedirect(nsIChannel *oldChannel,
|
|
nsIChannel *newChannel,
|
|
uint32_t flags,
|
|
nsIAsyncVerifyRedirectCallback *cb)
|
|
{
|
|
// In response to a redirect, we need to propagate the Range header. See bug
|
|
// 311595. Any failure code returned from this function aborts the redirect.
|
|
|
|
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(oldChannel);
|
|
NS_ENSURE_STATE(http);
|
|
|
|
nsCOMPtr<nsIHttpChannel> newHttpChannel = do_QueryInterface(newChannel);
|
|
NS_ENSURE_STATE(newHttpChannel);
|
|
|
|
NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");
|
|
|
|
nsresult rv = ClearRequestHeader(newHttpChannel);
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
|
|
// If we didn't have a Range header, then we must be doing a full download.
|
|
nsAutoCString rangeVal;
|
|
http->GetRequestHeader(rangeHdr, rangeVal);
|
|
if (!rangeVal.IsEmpty()) {
|
|
rv = newHttpChannel->SetRequestHeader(rangeHdr, rangeVal, false);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
}
|
|
|
|
// A redirection changes the validator
|
|
mPartialValidator.Truncate();
|
|
|
|
if (mCacheBust) {
|
|
newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
|
|
NS_LITERAL_CSTRING("no-cache"), false);
|
|
newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"),
|
|
NS_LITERAL_CSTRING("no-cache"), false);
|
|
}
|
|
|
|
// Prepare to receive callback
|
|
mRedirectCallback = cb;
|
|
mNewRedirectChannel = newChannel;
|
|
|
|
// Give the observer a chance to see this redirect notification.
|
|
nsCOMPtr<nsIChannelEventSink> sink = do_GetInterface(mObserver);
|
|
if (sink) {
|
|
rv = sink->AsyncOnChannelRedirect(oldChannel, newChannel, flags, this);
|
|
if (NS_FAILED(rv)) {
|
|
mRedirectCallback = nullptr;
|
|
mNewRedirectChannel = nullptr;
|
|
}
|
|
return rv;
|
|
}
|
|
(void) OnRedirectVerifyCallback(NS_OK);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsIncrementalDownload::OnRedirectVerifyCallback(nsresult result)
|
|
{
|
|
NS_ASSERTION(mRedirectCallback, "mRedirectCallback not set in callback");
|
|
NS_ASSERTION(mNewRedirectChannel, "mNewRedirectChannel not set in callback");
|
|
|
|
// Update mChannel, so we can Cancel the new channel.
|
|
if (NS_SUCCEEDED(result))
|
|
mChannel = mNewRedirectChannel;
|
|
|
|
mRedirectCallback->OnRedirectVerifyCallback(result);
|
|
mRedirectCallback = nullptr;
|
|
mNewRedirectChannel = nullptr;
|
|
return NS_OK;
|
|
}
|
|
|
|
extern nsresult
|
|
net_NewIncrementalDownload(nsISupports *outer, const nsIID &iid, void **result)
|
|
{
|
|
if (outer)
|
|
return NS_ERROR_NO_AGGREGATION;
|
|
|
|
nsIncrementalDownload *d = new nsIncrementalDownload();
|
|
if (!d)
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
NS_ADDREF(d);
|
|
nsresult rv = d->QueryInterface(iid, result);
|
|
NS_RELEASE(d);
|
|
return rv;
|
|
}
|