mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 22:25:30 +00:00
2185d3a4e6
--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
1046 lines
29 KiB
C++
1046 lines
29 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* 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 "ipc/IPCMessageUtils.h"
|
|
|
|
#if defined(XP_UNIX) || defined(XP_BEOS)
|
|
#include <unistd.h>
|
|
#elif defined(XP_WIN)
|
|
#include <windows.h>
|
|
#include "nsILocalFileWin.h"
|
|
#else
|
|
// XXX add necessary include file for ftruncate (or equivalent)
|
|
#endif
|
|
|
|
#include "private/pprio.h"
|
|
|
|
#include "nsFileStreams.h"
|
|
#include "nsIFile.h"
|
|
#include "nsReadLine.h"
|
|
#include "nsIClassInfoImpl.h"
|
|
#include "mozilla/ipc/InputStreamUtils.h"
|
|
#include "nsNetCID.h"
|
|
#include "nsXULAppAPI.h"
|
|
|
|
#define NS_NO_INPUT_BUFFERING 1 // see http://bugzilla.mozilla.org/show_bug.cgi?id=41067
|
|
|
|
typedef mozilla::ipc::FileDescriptor::PlatformHandleType FileHandleType;
|
|
|
|
using namespace mozilla::ipc;
|
|
using mozilla::DebugOnly;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsFileStreamBase
|
|
|
|
nsFileStreamBase::nsFileStreamBase()
|
|
: mFD(nullptr)
|
|
, mBehaviorFlags(0)
|
|
, mDeferredOpen(false)
|
|
{
|
|
}
|
|
|
|
nsFileStreamBase::~nsFileStreamBase()
|
|
{
|
|
Close();
|
|
}
|
|
|
|
NS_IMPL_ISUPPORTS(nsFileStreamBase,
|
|
nsISeekableStream,
|
|
nsIFileMetadata)
|
|
|
|
NS_IMETHODIMP
|
|
nsFileStreamBase::Seek(int32_t whence, int64_t offset)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (mFD == nullptr)
|
|
return NS_BASE_STREAM_CLOSED;
|
|
|
|
int64_t cnt = PR_Seek64(mFD, offset, (PRSeekWhence)whence);
|
|
if (cnt == int64_t(-1)) {
|
|
return NS_ErrorAccordingToNSPR();
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileStreamBase::Tell(int64_t *result)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (mFD == nullptr)
|
|
return NS_BASE_STREAM_CLOSED;
|
|
|
|
int64_t cnt = PR_Seek64(mFD, 0, PR_SEEK_CUR);
|
|
if (cnt == int64_t(-1)) {
|
|
return NS_ErrorAccordingToNSPR();
|
|
}
|
|
*result = cnt;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileStreamBase::SetEOF()
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (mFD == nullptr)
|
|
return NS_BASE_STREAM_CLOSED;
|
|
|
|
#if defined(XP_UNIX) || defined(XP_BEOS)
|
|
// Some system calls require an EOF offset.
|
|
int64_t offset;
|
|
rv = Tell(&offset);
|
|
if (NS_FAILED(rv)) return rv;
|
|
#endif
|
|
|
|
#if defined(XP_UNIX) || defined(XP_BEOS)
|
|
if (ftruncate(PR_FileDesc2NativeHandle(mFD), offset) != 0) {
|
|
NS_ERROR("ftruncate failed");
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
#elif defined(XP_WIN)
|
|
if (!SetEndOfFile((HANDLE) PR_FileDesc2NativeHandle(mFD))) {
|
|
NS_ERROR("SetEndOfFile failed");
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
#else
|
|
// XXX not implemented
|
|
#endif
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileStreamBase::GetSize(int64_t* _retval)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (!mFD) {
|
|
return NS_BASE_STREAM_CLOSED;
|
|
}
|
|
|
|
PRFileInfo64 info;
|
|
if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
|
|
return NS_BASE_STREAM_OSERROR;
|
|
}
|
|
|
|
*_retval = int64_t(info.size);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileStreamBase::GetLastModified(int64_t* _retval)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (!mFD) {
|
|
return NS_BASE_STREAM_CLOSED;
|
|
}
|
|
|
|
PRFileInfo64 info;
|
|
if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
|
|
return NS_BASE_STREAM_OSERROR;
|
|
}
|
|
|
|
int64_t modTime = int64_t(info.modifyTime);
|
|
if (modTime == 0) {
|
|
*_retval = 0;
|
|
}
|
|
else {
|
|
*_retval = modTime / int64_t(PR_USEC_PER_MSEC);
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::Close()
|
|
{
|
|
CleanUpOpen();
|
|
|
|
nsresult rv = NS_OK;
|
|
if (mFD) {
|
|
if (PR_Close(mFD) == PR_FAILURE)
|
|
rv = NS_BASE_STREAM_OSERROR;
|
|
mFD = nullptr;
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::Available(uint64_t* aResult)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (!mFD) {
|
|
return NS_BASE_STREAM_CLOSED;
|
|
}
|
|
|
|
// PR_Available with files over 4GB returns an error, so we have to
|
|
// use the 64-bit version of PR_Available.
|
|
int64_t avail = PR_Available64(mFD);
|
|
if (avail == -1) {
|
|
return NS_ErrorAccordingToNSPR();
|
|
}
|
|
|
|
// If available is greater than 4GB, return 4GB
|
|
*aResult = (uint64_t)avail;
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::Read(char* aBuf, uint32_t aCount, uint32_t* aResult)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (!mFD) {
|
|
*aResult = 0;
|
|
return NS_OK;
|
|
}
|
|
|
|
int32_t bytesRead = PR_Read(mFD, aBuf, aCount);
|
|
if (bytesRead == -1) {
|
|
return NS_ErrorAccordingToNSPR();
|
|
}
|
|
|
|
*aResult = bytesRead;
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
|
|
uint32_t aCount, uint32_t* aResult)
|
|
{
|
|
// ReadSegments is not implemented because it would be inefficient when
|
|
// the writer does not consume all data. If you want to call ReadSegments,
|
|
// wrap a BufferedInputStream around the file stream. That will call
|
|
// Read().
|
|
|
|
// If this is ever implemented you might need to modify
|
|
// nsPartialFileInputStream::ReadSegments
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::IsNonBlocking(bool *aNonBlocking)
|
|
{
|
|
*aNonBlocking = false;
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::Flush(void)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (mFD == nullptr)
|
|
return NS_BASE_STREAM_CLOSED;
|
|
|
|
int32_t cnt = PR_Sync(mFD);
|
|
if (cnt == -1) {
|
|
return NS_ErrorAccordingToNSPR();
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::Write(const char *buf, uint32_t count, uint32_t *result)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (mFD == nullptr)
|
|
return NS_BASE_STREAM_CLOSED;
|
|
|
|
int32_t cnt = PR_Write(mFD, buf, count);
|
|
if (cnt == -1) {
|
|
return NS_ErrorAccordingToNSPR();
|
|
}
|
|
*result = cnt;
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::WriteFrom(nsIInputStream *inStr, uint32_t count, uint32_t *_retval)
|
|
{
|
|
NS_NOTREACHED("WriteFrom (see source comment)");
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
// File streams intentionally do not support this method.
|
|
// If you need something like this, then you should wrap
|
|
// the file stream using nsIBufferedOutputStream
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::WriteSegments(nsReadSegmentFun reader, void * closure, uint32_t count, uint32_t *_retval)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
// File streams intentionally do not support this method.
|
|
// If you need something like this, then you should wrap
|
|
// the file stream using nsIBufferedOutputStream
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::MaybeOpen(nsIFile* aFile, int32_t aIoFlags,
|
|
int32_t aPerm, bool aDeferred)
|
|
{
|
|
NS_ENSURE_STATE(aFile);
|
|
|
|
mOpenParams.ioFlags = aIoFlags;
|
|
mOpenParams.perm = aPerm;
|
|
|
|
if (aDeferred) {
|
|
// Clone the file, as it may change between now and the deferred open
|
|
nsCOMPtr<nsIFile> file;
|
|
nsresult rv = aFile->Clone(getter_AddRefs(file));
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
mOpenParams.localFile = do_QueryInterface(file);
|
|
NS_ENSURE_TRUE(mOpenParams.localFile, NS_ERROR_UNEXPECTED);
|
|
|
|
mDeferredOpen = true;
|
|
return NS_OK;
|
|
}
|
|
|
|
mOpenParams.localFile = aFile;
|
|
|
|
return DoOpen();
|
|
}
|
|
|
|
void
|
|
nsFileStreamBase::CleanUpOpen()
|
|
{
|
|
mOpenParams.localFile = nullptr;
|
|
mDeferredOpen = false;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::DoOpen()
|
|
{
|
|
NS_ASSERTION(!mFD, "Already have a file descriptor!");
|
|
NS_ASSERTION(mOpenParams.localFile, "Must have a file to open");
|
|
|
|
PRFileDesc* fd;
|
|
nsresult rv;
|
|
|
|
#ifdef XP_WIN
|
|
if (mBehaviorFlags & nsIFileInputStream::SHARE_DELETE) {
|
|
nsCOMPtr<nsILocalFileWin> file = do_QueryInterface(mOpenParams.localFile);
|
|
MOZ_ASSERT(file);
|
|
|
|
rv = file->OpenNSPRFileDescShareDelete(mOpenParams.ioFlags,
|
|
mOpenParams.perm,
|
|
&fd);
|
|
} else
|
|
#endif // XP_WIN
|
|
{
|
|
rv = mOpenParams.localFile->OpenNSPRFileDesc(mOpenParams.ioFlags,
|
|
mOpenParams.perm,
|
|
&fd);
|
|
}
|
|
|
|
CleanUpOpen();
|
|
if (NS_FAILED(rv))
|
|
return rv;
|
|
mFD = fd;
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
nsFileStreamBase::DoPendingOpen()
|
|
{
|
|
if (!mDeferredOpen) {
|
|
return NS_OK;
|
|
}
|
|
|
|
return DoOpen();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsFileInputStream
|
|
|
|
NS_IMPL_ADDREF_INHERITED(nsFileInputStream, nsFileStreamBase)
|
|
NS_IMPL_RELEASE_INHERITED(nsFileInputStream, nsFileStreamBase)
|
|
|
|
NS_IMPL_CLASSINFO(nsFileInputStream, nullptr, nsIClassInfo::THREADSAFE,
|
|
NS_LOCALFILEINPUTSTREAM_CID)
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsFileInputStream)
|
|
NS_INTERFACE_MAP_ENTRY(nsIInputStream)
|
|
NS_INTERFACE_MAP_ENTRY(nsIFileInputStream)
|
|
NS_INTERFACE_MAP_ENTRY(nsILineInputStream)
|
|
NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableInputStream)
|
|
NS_IMPL_QUERY_CLASSINFO(nsFileInputStream)
|
|
NS_INTERFACE_MAP_END_INHERITING(nsFileStreamBase)
|
|
|
|
NS_IMPL_CI_INTERFACE_GETTER(nsFileInputStream,
|
|
nsIInputStream,
|
|
nsIFileInputStream,
|
|
nsISeekableStream,
|
|
nsILineInputStream)
|
|
|
|
nsresult
|
|
nsFileInputStream::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|
{
|
|
NS_ENSURE_NO_AGGREGATION(aOuter);
|
|
|
|
nsFileInputStream* stream = new nsFileInputStream();
|
|
if (stream == nullptr)
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
NS_ADDREF(stream);
|
|
nsresult rv = stream->QueryInterface(aIID, aResult);
|
|
NS_RELEASE(stream);
|
|
return rv;
|
|
}
|
|
|
|
nsresult
|
|
nsFileInputStream::Open(nsIFile* aFile, int32_t aIOFlags, int32_t aPerm)
|
|
{
|
|
nsresult rv = NS_OK;
|
|
|
|
// If the previous file is open, close it
|
|
if (mFD) {
|
|
rv = Close();
|
|
if (NS_FAILED(rv)) return rv;
|
|
}
|
|
|
|
// Open the file
|
|
if (aIOFlags == -1)
|
|
aIOFlags = PR_RDONLY;
|
|
if (aPerm == -1)
|
|
aPerm = 0;
|
|
|
|
rv = MaybeOpen(aFile, aIOFlags, aPerm,
|
|
mBehaviorFlags & nsIFileInputStream::DEFER_OPEN);
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
if (mBehaviorFlags & DELETE_ON_CLOSE) {
|
|
// POSIX compatible filesystems allow a file to be unlinked while a
|
|
// file descriptor is still referencing the file. since we've already
|
|
// opened the file descriptor, we'll try to remove the file. if that
|
|
// fails, then we'll just remember the nsIFile and remove it after we
|
|
// close the file descriptor.
|
|
rv = aFile->Remove(false);
|
|
if (NS_SUCCEEDED(rv)) {
|
|
// No need to remove it later. Clear the flag.
|
|
mBehaviorFlags &= ~DELETE_ON_CLOSE;
|
|
}
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileInputStream::Init(nsIFile* aFile, int32_t aIOFlags, int32_t aPerm,
|
|
int32_t aBehaviorFlags)
|
|
{
|
|
NS_ENSURE_TRUE(!mFD, NS_ERROR_ALREADY_INITIALIZED);
|
|
NS_ENSURE_TRUE(!mDeferredOpen, NS_ERROR_ALREADY_INITIALIZED);
|
|
|
|
mBehaviorFlags = aBehaviorFlags;
|
|
|
|
mFile = aFile;
|
|
mIOFlags = aIOFlags;
|
|
mPerm = aPerm;
|
|
|
|
return Open(aFile, aIOFlags, aPerm);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileInputStream::Close()
|
|
{
|
|
// Get the cache position at the time the file was close. This allows
|
|
// NS_SEEK_CUR on a closed file that has been opened with
|
|
// REOPEN_ON_REWIND.
|
|
if (mBehaviorFlags & REOPEN_ON_REWIND) {
|
|
// Get actual position. Not one modified by subclasses
|
|
nsFileStreamBase::Tell(&mCachedPosition);
|
|
}
|
|
|
|
// null out mLineBuffer in case Close() is called again after failing
|
|
mLineBuffer = nullptr;
|
|
nsresult rv = nsFileStreamBase::Close();
|
|
if (NS_FAILED(rv)) return rv;
|
|
if (mFile && (mBehaviorFlags & DELETE_ON_CLOSE)) {
|
|
rv = mFile->Remove(false);
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to delete file");
|
|
// If we don't need to save the file for reopening, free it up
|
|
if (!(mBehaviorFlags & REOPEN_ON_REWIND)) {
|
|
mFile = nullptr;
|
|
}
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileInputStream::Read(char* aBuf, uint32_t aCount, uint32_t* _retval)
|
|
{
|
|
nsresult rv = nsFileStreamBase::Read(aBuf, aCount, _retval);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
// Check if we're at the end of file and need to close
|
|
if (mBehaviorFlags & CLOSE_ON_EOF && *_retval == 0) {
|
|
Close();
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileInputStream::ReadLine(nsACString& aLine, bool* aResult)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (!mLineBuffer) {
|
|
mLineBuffer = new nsLineBuffer<char>;
|
|
}
|
|
return NS_ReadLine(this, mLineBuffer.get(), aLine, aResult);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileInputStream::Seek(int32_t aWhence, int64_t aOffset)
|
|
{
|
|
nsresult rv = DoPendingOpen();
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
mLineBuffer = nullptr;
|
|
if (!mFD) {
|
|
if (mBehaviorFlags & REOPEN_ON_REWIND) {
|
|
rv = Open(mFile, mIOFlags, mPerm);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
// If the file was closed, and we do a relative seek, use the
|
|
// position we cached when we closed the file to seek to the right
|
|
// location.
|
|
if (aWhence == NS_SEEK_CUR) {
|
|
aWhence = NS_SEEK_SET;
|
|
aOffset += mCachedPosition;
|
|
}
|
|
} else {
|
|
return NS_BASE_STREAM_CLOSED;
|
|
}
|
|
}
|
|
|
|
return nsFileStreamBase::Seek(aWhence, aOffset);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileInputStream::Tell(int64_t *aResult)
|
|
{
|
|
return nsFileStreamBase::Tell(aResult);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileInputStream::Available(uint64_t *aResult)
|
|
{
|
|
return nsFileStreamBase::Available(aResult);
|
|
}
|
|
|
|
void
|
|
nsFileInputStream::Serialize(InputStreamParams& aParams,
|
|
FileDescriptorArray& aFileDescriptors)
|
|
{
|
|
FileInputStreamParams params;
|
|
|
|
if (mFD) {
|
|
FileHandleType fd = FileHandleType(PR_FileDesc2NativeHandle(mFD));
|
|
NS_ASSERTION(fd, "This should never be null!");
|
|
|
|
DebugOnly<FileDescriptor*> dbgFD = aFileDescriptors.AppendElement(fd);
|
|
NS_ASSERTION(dbgFD->IsValid(), "Sending an invalid file descriptor!");
|
|
|
|
params.fileDescriptorIndex() = aFileDescriptors.Length() - 1;
|
|
|
|
Close();
|
|
} else {
|
|
NS_WARNING("This file has not been opened (or could not be opened). "
|
|
"Sending an invalid file descriptor to the other process!");
|
|
|
|
params.fileDescriptorIndex() = UINT32_MAX;
|
|
}
|
|
|
|
int32_t behaviorFlags = mBehaviorFlags;
|
|
|
|
// The receiving process (or thread) is going to have an open file
|
|
// descriptor automatically so transferring this flag is meaningless.
|
|
behaviorFlags &= ~nsIFileInputStream::DEFER_OPEN;
|
|
|
|
params.behaviorFlags() = behaviorFlags;
|
|
params.ioFlags() = mIOFlags;
|
|
|
|
aParams = params;
|
|
}
|
|
|
|
bool
|
|
nsFileInputStream::Deserialize(const InputStreamParams& aParams,
|
|
const FileDescriptorArray& aFileDescriptors)
|
|
{
|
|
NS_ASSERTION(!mFD, "Already have a file descriptor?!");
|
|
NS_ASSERTION(!mDeferredOpen, "Deferring open?!");
|
|
NS_ASSERTION(!mFile, "Should never have a file here!");
|
|
NS_ASSERTION(!mPerm, "This should always be 0!");
|
|
|
|
if (aParams.type() != InputStreamParams::TFileInputStreamParams) {
|
|
NS_WARNING("Received unknown parameters from the other process!");
|
|
return false;
|
|
}
|
|
|
|
const FileInputStreamParams& params = aParams.get_FileInputStreamParams();
|
|
|
|
uint32_t fileDescriptorIndex = params.fileDescriptorIndex();
|
|
|
|
FileDescriptor fd;
|
|
if (fileDescriptorIndex < aFileDescriptors.Length()) {
|
|
fd = aFileDescriptors[fileDescriptorIndex];
|
|
NS_WARN_IF_FALSE(fd.IsValid(), "Received an invalid file descriptor!");
|
|
} else {
|
|
NS_WARNING("Received a bad file descriptor index!");
|
|
}
|
|
|
|
if (fd.IsValid()) {
|
|
PRFileDesc* fileDesc = PR_ImportFile(PROsfd(fd.PlatformHandle()));
|
|
if (!fileDesc) {
|
|
NS_WARNING("Failed to import file handle!");
|
|
return false;
|
|
}
|
|
mFD = fileDesc;
|
|
}
|
|
|
|
mBehaviorFlags = params.behaviorFlags();
|
|
|
|
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
|
// A child process shouldn't close when it reads the end because it will
|
|
// not be able to reopen the file later.
|
|
mBehaviorFlags &= ~nsIFileInputStream::CLOSE_ON_EOF;
|
|
|
|
// A child process will not be able to reopen the file so this flag is
|
|
// meaningless.
|
|
mBehaviorFlags &= ~nsIFileInputStream::REOPEN_ON_REWIND;
|
|
}
|
|
|
|
mIOFlags = params.ioFlags();
|
|
|
|
return true;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsPartialFileInputStream
|
|
|
|
NS_IMPL_ADDREF_INHERITED(nsPartialFileInputStream, nsFileStreamBase)
|
|
NS_IMPL_RELEASE_INHERITED(nsPartialFileInputStream, nsFileStreamBase)
|
|
|
|
NS_IMPL_CLASSINFO(nsPartialFileInputStream, nullptr, nsIClassInfo::THREADSAFE,
|
|
NS_PARTIALLOCALFILEINPUTSTREAM_CID)
|
|
|
|
// Don't forward to nsFileInputStream as we don't want to QI to
|
|
// nsIFileInputStream
|
|
NS_INTERFACE_MAP_BEGIN(nsPartialFileInputStream)
|
|
NS_INTERFACE_MAP_ENTRY(nsIInputStream)
|
|
NS_INTERFACE_MAP_ENTRY(nsIPartialFileInputStream)
|
|
NS_INTERFACE_MAP_ENTRY(nsILineInputStream)
|
|
NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableInputStream)
|
|
NS_IMPL_QUERY_CLASSINFO(nsPartialFileInputStream)
|
|
NS_INTERFACE_MAP_END_INHERITING(nsFileStreamBase)
|
|
|
|
NS_IMPL_CI_INTERFACE_GETTER(nsPartialFileInputStream,
|
|
nsIInputStream,
|
|
nsIPartialFileInputStream,
|
|
nsISeekableStream,
|
|
nsILineInputStream)
|
|
|
|
nsresult
|
|
nsPartialFileInputStream::Create(nsISupports *aOuter, REFNSIID aIID,
|
|
void **aResult)
|
|
{
|
|
NS_ENSURE_NO_AGGREGATION(aOuter);
|
|
|
|
nsPartialFileInputStream* stream = new nsPartialFileInputStream();
|
|
|
|
NS_ADDREF(stream);
|
|
nsresult rv = stream->QueryInterface(aIID, aResult);
|
|
NS_RELEASE(stream);
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPartialFileInputStream::Init(nsIFile* aFile, uint64_t aStart,
|
|
uint64_t aLength, int32_t aIOFlags,
|
|
int32_t aPerm, int32_t aBehaviorFlags)
|
|
{
|
|
mStart = aStart;
|
|
mLength = aLength;
|
|
mPosition = 0;
|
|
|
|
nsresult rv = nsFileInputStream::Init(aFile, aIOFlags, aPerm,
|
|
aBehaviorFlags);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
return nsFileInputStream::Seek(NS_SEEK_SET, mStart);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPartialFileInputStream::Tell(int64_t *aResult)
|
|
{
|
|
int64_t tell = 0;
|
|
nsresult rv = nsFileInputStream::Tell(&tell);
|
|
if (NS_SUCCEEDED(rv)) {
|
|
*aResult = tell - mStart;
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPartialFileInputStream::Available(uint64_t* aResult)
|
|
{
|
|
uint64_t available = 0;
|
|
nsresult rv = nsFileInputStream::Available(&available);
|
|
if (NS_SUCCEEDED(rv)) {
|
|
*aResult = TruncateSize(available);
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPartialFileInputStream::Read(char* aBuf, uint32_t aCount, uint32_t* aResult)
|
|
{
|
|
uint32_t readsize = (uint32_t) TruncateSize(aCount);
|
|
if (readsize == 0 && mBehaviorFlags & CLOSE_ON_EOF) {
|
|
Close();
|
|
*aResult = 0;
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult rv = nsFileInputStream::Read(aBuf, readsize, aResult);
|
|
if (NS_SUCCEEDED(rv)) {
|
|
mPosition += readsize;
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsPartialFileInputStream::Seek(int32_t aWhence, int64_t aOffset)
|
|
{
|
|
int64_t offset;
|
|
switch (aWhence) {
|
|
case NS_SEEK_SET:
|
|
offset = mStart + aOffset;
|
|
break;
|
|
case NS_SEEK_CUR:
|
|
offset = mStart + mPosition + aOffset;
|
|
break;
|
|
case NS_SEEK_END:
|
|
offset = mStart + mLength + aOffset;
|
|
break;
|
|
default:
|
|
return NS_ERROR_ILLEGAL_VALUE;
|
|
}
|
|
|
|
if (offset < (int64_t)mStart || offset > (int64_t)(mStart + mLength)) {
|
|
return NS_ERROR_INVALID_ARG;
|
|
}
|
|
|
|
nsresult rv = nsFileInputStream::Seek(NS_SEEK_SET, offset);
|
|
if (NS_SUCCEEDED(rv)) {
|
|
mPosition = offset - mStart;
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
void
|
|
nsPartialFileInputStream::Serialize(InputStreamParams& aParams,
|
|
FileDescriptorArray& aFileDescriptors)
|
|
{
|
|
// Serialize the base class first.
|
|
InputStreamParams fileParams;
|
|
nsFileInputStream::Serialize(fileParams, aFileDescriptors);
|
|
|
|
PartialFileInputStreamParams params;
|
|
|
|
params.fileStreamParams() = fileParams.get_FileInputStreamParams();
|
|
params.begin() = mStart;
|
|
params.length() = mLength;
|
|
|
|
aParams = params;
|
|
}
|
|
|
|
bool
|
|
nsPartialFileInputStream::Deserialize(
|
|
const InputStreamParams& aParams,
|
|
const FileDescriptorArray& aFileDescriptors)
|
|
{
|
|
NS_ASSERTION(!mFD, "Already have a file descriptor?!");
|
|
NS_ASSERTION(!mStart, "Already have a start?!");
|
|
NS_ASSERTION(!mLength, "Already have a length?!");
|
|
NS_ASSERTION(!mPosition, "Already have a position?!");
|
|
|
|
if (aParams.type() != InputStreamParams::TPartialFileInputStreamParams) {
|
|
NS_WARNING("Received unknown parameters from the other process!");
|
|
return false;
|
|
}
|
|
|
|
const PartialFileInputStreamParams& params =
|
|
aParams.get_PartialFileInputStreamParams();
|
|
|
|
// Deserialize the base class first.
|
|
InputStreamParams fileParams(params.fileStreamParams());
|
|
if (!nsFileInputStream::Deserialize(fileParams, aFileDescriptors)) {
|
|
NS_WARNING("Base class deserialize failed!");
|
|
return false;
|
|
}
|
|
|
|
NS_ASSERTION(mFD, "Must have a file descriptor now!");
|
|
|
|
mStart = params.begin();
|
|
mLength = params.length();
|
|
mPosition = 0;
|
|
|
|
if (!mStart) {
|
|
return true;
|
|
}
|
|
|
|
// XXX This is so broken. Main thread IO alert.
|
|
return NS_SUCCEEDED(nsFileInputStream::Seek(NS_SEEK_SET, mStart));
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsFileOutputStream
|
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(nsFileOutputStream,
|
|
nsFileStreamBase,
|
|
nsIOutputStream,
|
|
nsIFileOutputStream)
|
|
|
|
nsresult
|
|
nsFileOutputStream::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|
{
|
|
NS_ENSURE_NO_AGGREGATION(aOuter);
|
|
|
|
nsFileOutputStream* stream = new nsFileOutputStream();
|
|
if (stream == nullptr)
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
NS_ADDREF(stream);
|
|
nsresult rv = stream->QueryInterface(aIID, aResult);
|
|
NS_RELEASE(stream);
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsFileOutputStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
|
|
int32_t behaviorFlags)
|
|
{
|
|
NS_ENSURE_TRUE(mFD == nullptr, NS_ERROR_ALREADY_INITIALIZED);
|
|
NS_ENSURE_TRUE(!mDeferredOpen, NS_ERROR_ALREADY_INITIALIZED);
|
|
|
|
mBehaviorFlags = behaviorFlags;
|
|
|
|
if (ioFlags == -1)
|
|
ioFlags = PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE;
|
|
if (perm <= 0)
|
|
perm = 0664;
|
|
|
|
return MaybeOpen(file, ioFlags, perm,
|
|
mBehaviorFlags & nsIFileOutputStream::DEFER_OPEN);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsAtomicFileOutputStream
|
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(nsAtomicFileOutputStream,
|
|
nsFileOutputStream,
|
|
nsISafeOutputStream,
|
|
nsIOutputStream,
|
|
nsIFileOutputStream)
|
|
|
|
NS_IMETHODIMP
|
|
nsAtomicFileOutputStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
|
|
int32_t behaviorFlags)
|
|
{
|
|
// While `PR_APPEND` is not supported, `-1` is used as `ioFlags` parameter
|
|
// in some places, and `PR_APPEND | PR_TRUNCATE` does not require appending
|
|
// to existing file. So, throw an exception only if `PR_APPEND` is
|
|
// explicitly specified without `PR_TRUNCATE`.
|
|
if ((ioFlags & PR_APPEND) && !(ioFlags & PR_TRUNCATE)) {
|
|
return NS_ERROR_INVALID_ARG;
|
|
}
|
|
return nsFileOutputStream::Init(file, ioFlags, perm, behaviorFlags);
|
|
}
|
|
|
|
nsresult
|
|
nsAtomicFileOutputStream::DoOpen()
|
|
{
|
|
// Make sure mOpenParams.localFile will be empty if we bail somewhere in
|
|
// this function
|
|
nsCOMPtr<nsIFile> file;
|
|
file.swap(mOpenParams.localFile);
|
|
|
|
nsresult rv = file->Exists(&mTargetFileExists);
|
|
if (NS_FAILED(rv)) {
|
|
NS_ERROR("Can't tell if target file exists");
|
|
mTargetFileExists = true; // Safer to assume it exists - we just do more work.
|
|
}
|
|
|
|
// follow symlinks, for two reasons:
|
|
// 1) if a user has deliberately set up a profile file as a symlink, we honor it
|
|
// 2) to make the MoveToNative() in Finish() an atomic operation (which may not
|
|
// be the case if moving across directories on different filesystems).
|
|
nsCOMPtr<nsIFile> tempResult;
|
|
rv = file->Clone(getter_AddRefs(tempResult));
|
|
if (NS_SUCCEEDED(rv)) {
|
|
tempResult->SetFollowLinks(true);
|
|
|
|
// XP_UNIX ignores SetFollowLinks(), so we have to normalize.
|
|
tempResult->Normalize();
|
|
}
|
|
|
|
if (NS_SUCCEEDED(rv) && mTargetFileExists) {
|
|
uint32_t origPerm;
|
|
if (NS_FAILED(file->GetPermissions(&origPerm))) {
|
|
NS_ERROR("Can't get permissions of target file");
|
|
origPerm = mOpenParams.perm;
|
|
}
|
|
// XXX What if |perm| is more restrictive then |origPerm|?
|
|
// This leaves the user supplied permissions as they were.
|
|
rv = tempResult->CreateUnique(nsIFile::NORMAL_FILE_TYPE, origPerm);
|
|
}
|
|
if (NS_SUCCEEDED(rv)) {
|
|
// nsFileOutputStream::DoOpen will work on the temporary file, so we
|
|
// prepare it and place it in mOpenParams.localFile.
|
|
mOpenParams.localFile = tempResult;
|
|
mTempFile = tempResult;
|
|
mTargetFile = file;
|
|
rv = nsFileOutputStream::DoOpen();
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsAtomicFileOutputStream::Close()
|
|
{
|
|
nsresult rv = nsFileOutputStream::Close();
|
|
|
|
// the consumer doesn't want the original file overwritten -
|
|
// so clean up by removing the temp file.
|
|
if (mTempFile) {
|
|
mTempFile->Remove(false);
|
|
mTempFile = nullptr;
|
|
}
|
|
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsAtomicFileOutputStream::Finish()
|
|
{
|
|
nsresult rv = nsFileOutputStream::Close();
|
|
|
|
// if there is no temp file, don't try to move it over the original target.
|
|
// It would destroy the targetfile if close() is called twice.
|
|
if (!mTempFile)
|
|
return rv;
|
|
|
|
// Only overwrite if everything was ok, and the temp file could be closed.
|
|
if (NS_SUCCEEDED(mWriteResult) && NS_SUCCEEDED(rv)) {
|
|
NS_ENSURE_STATE(mTargetFile);
|
|
|
|
if (!mTargetFileExists) {
|
|
// If the target file did not exist when we were initialized, then the
|
|
// temp file we gave out was actually a reference to the target file.
|
|
// since we succeeded in writing to the temp file (and hence succeeded
|
|
// in writing to the target file), there is nothing more to do.
|
|
#ifdef DEBUG
|
|
bool equal;
|
|
if (NS_FAILED(mTargetFile->Equals(mTempFile, &equal)) || !equal)
|
|
NS_ERROR("mTempFile not equal to mTargetFile");
|
|
#endif
|
|
}
|
|
else {
|
|
nsAutoString targetFilename;
|
|
rv = mTargetFile->GetLeafName(targetFilename);
|
|
if (NS_SUCCEEDED(rv)) {
|
|
// This will replace target.
|
|
rv = mTempFile->MoveTo(nullptr, targetFilename);
|
|
if (NS_FAILED(rv))
|
|
mTempFile->Remove(false);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
mTempFile->Remove(false);
|
|
|
|
// if writing failed, propagate the failure code to the caller.
|
|
if (NS_FAILED(mWriteResult))
|
|
rv = mWriteResult;
|
|
}
|
|
mTempFile = nullptr;
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsAtomicFileOutputStream::Write(const char *buf, uint32_t count, uint32_t *result)
|
|
{
|
|
nsresult rv = nsFileOutputStream::Write(buf, count, result);
|
|
if (NS_SUCCEEDED(mWriteResult)) {
|
|
if (NS_FAILED(rv))
|
|
mWriteResult = rv;
|
|
else if (count != *result)
|
|
mWriteResult = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
|
|
|
|
if (NS_FAILED(mWriteResult) && count > 0)
|
|
NS_WARNING("writing to output stream failed! data may be lost");
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsSafeFileOutputStream
|
|
|
|
NS_IMETHODIMP
|
|
nsSafeFileOutputStream::Finish()
|
|
{
|
|
(void) Flush();
|
|
return nsAtomicFileOutputStream::Finish();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// nsFileStream
|
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(nsFileStream,
|
|
nsFileStreamBase,
|
|
nsIInputStream,
|
|
nsIOutputStream,
|
|
nsIFileStream)
|
|
|
|
NS_IMETHODIMP
|
|
nsFileStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
|
|
int32_t behaviorFlags)
|
|
{
|
|
NS_ENSURE_TRUE(mFD == nullptr, NS_ERROR_ALREADY_INITIALIZED);
|
|
NS_ENSURE_TRUE(!mDeferredOpen, NS_ERROR_ALREADY_INITIALIZED);
|
|
|
|
mBehaviorFlags = behaviorFlags;
|
|
|
|
if (ioFlags == -1)
|
|
ioFlags = PR_RDWR;
|
|
if (perm <= 0)
|
|
perm = 0;
|
|
|
|
return MaybeOpen(file, ioFlags, perm,
|
|
mBehaviorFlags & nsIFileStream::DEFER_OPEN);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|