tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 891d40df1dd1bf25ce8524395b35b2fb11e80a1f
parent 4ff46835ea256761575b1b760dc45a423ed02125
Author: Nika Layzell <nika@thelayzells.com>
Date:   Thu, 20 Nov 2025 23:12:06 +0000

Bug 2000994 - Part 4: Use nsBaseParentChannel for nsFileChannel, r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D273127

Diffstat:
Mnetwerk/ipc/NeckoChild.cpp | 1-
Mnetwerk/ipc/NeckoParent.cpp | 13+++++--------
Mnetwerk/ipc/NeckoParent.h | 6++----
Dnetwerk/ipc/PFileChannel.ipdl | 31-------------------------------
Mnetwerk/ipc/PNecko.ipdl | 9++++++---
Mnetwerk/ipc/moz.build | 1-
Dnetwerk/protocol/file/FileChannelChild.cpp | 66------------------------------------------------------------------
Dnetwerk/protocol/file/FileChannelChild.h | 38--------------------------------------
Dnetwerk/protocol/file/FileChannelParent.cpp | 145-------------------------------------------------------------------------------
Dnetwerk/protocol/file/FileChannelParent.h | 44--------------------------------------------
Mnetwerk/protocol/file/moz.build | 4----
Mnetwerk/protocol/file/nsFileChannel.cpp | 84++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
Mnetwerk/protocol/file/nsFileChannel.h | 14++++++++++++--
Mnetwerk/protocol/file/nsFileProtocolHandler.cpp | 9+--------
14 files changed, 90 insertions(+), 375 deletions(-)

diff --git a/netwerk/ipc/NeckoChild.cpp b/netwerk/ipc/NeckoChild.cpp @@ -15,7 +15,6 @@ #ifdef MOZ_WIDGET_GTK # include "mozilla/net/GIOChannelChild.h" #endif -#include "mozilla/net/FileChannelChild.h" #include "mozilla/net/WebSocketChannelChild.h" #include "mozilla/net/WebSocketEventListenerChild.h" #include "mozilla/net/DNSRequestChild.h" diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp @@ -26,7 +26,6 @@ #endif #include "mozilla/net/DocumentChannelParent.h" #include "mozilla/net/AltDataOutputStreamParent.h" -#include "mozilla/net/FileChannelParent.h" #include "mozilla/net/DNSRequestParent.h" #include "mozilla/net/IPCTransportProvider.h" #include "mozilla/net/RemoteStreamGetter.h" @@ -56,6 +55,7 @@ #include "nsINetworkPredictor.h" #include "nsINetworkPredictorVerifier.h" #include "nsISpeculativeConnect.h" +#include "nsFileChannel.h" #include "nsHttpHandler.h" #include "nsNetUtil.h" #include "nsIOService.h" @@ -412,13 +412,10 @@ mozilla::ipc::IPCResult NeckoParent::RecvPGeckoViewContentChannelConstructor( } #endif -already_AddRefed<PFileChannelParent> NeckoParent::AllocPFileChannelParent() { - RefPtr<FileChannelParent> p = new FileChannelParent(); - return p.forget(); -} - -mozilla::ipc::IPCResult NeckoParent::RecvPFileChannelConstructor( - PFileChannelParent* actor) { +mozilla::ipc::IPCResult NeckoParent::RecvNotifyFileChannelOpened( + const FileChannelInfo& aInfo) { + nsFileChannel::DoNotifyFileChannelOpened( + ContentParent::Cast(Manager())->GetRemoteType(), aInfo); return IPC_OK(); } diff --git a/netwerk/ipc/NeckoParent.h b/netwerk/ipc/NeckoParent.h @@ -162,10 +162,8 @@ class NeckoParent : public PNeckoParent { const GeckoViewContentChannelArgs& args) override; # endif - already_AddRefed<PFileChannelParent> AllocPFileChannelParent(); - - virtual mozilla::ipc::IPCResult RecvPFileChannelConstructor( - PFileChannelParent* aActor) override; + mozilla::ipc::IPCResult RecvNotifyFileChannelOpened( + const FileChannelInfo& aInfo); PTransportProviderParent* AllocPTransportProviderParent(); bool DeallocPTransportProviderParent(PTransportProviderParent* aActor); diff --git a/netwerk/ipc/PFileChannel.ipdl b/netwerk/ipc/PFileChannel.ipdl @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set sw=2 ts=2 sts=2 et tw=80 ft=cpp : */ - -/* 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 protocol PNecko; -include NeckoChannelParams; - -namespace mozilla { -namespace net { - -/* Used to facilitate http redirects to file:// - see - * https://bugzilla.mozilla.org/show_bug.cgi?id=1345094 - */ -[ChildImpl=virtual] -async protocol PFileChannel -{ - manager PNecko; - -parent: - // Note: channels are opened during construction, so no open method here: - // see PNecko.ipdl - async __delete__(); - async NotifyListeners(FileChannelInfo aFileChannelInfo); - async SetChannelIdForRedirect(uint64_t aChannelId); -}; - -} // namespace net -} // namespace mozilla diff --git a/netwerk/ipc/PNecko.ipdl b/netwerk/ipc/PNecko.ipdl @@ -23,7 +23,6 @@ include protocol PUDPSocket; include protocol PDNSRequest; include protocol PTransportProvider; include protocol PStunAddrsRequest; -include protocol PFileChannel; include protocol PWebrtcTCPSocket; include protocol PSocketProcessBridge; include protocol PDocumentChannel; @@ -64,7 +63,6 @@ namespace net { #ifdef MOZ_WIDGET_ANDROID manages PGeckoViewContentChannel; #endif - manages PFileChannel; manages PTransportProvider; manages PAltDataOutputStream; manages PStunAddrsRequest; @@ -121,7 +119,6 @@ parent: #ifdef MOZ_WIDGET_GTK async PGIOChannel(nullable PBrowser browser, SerializedLoadContext loadContext, GIOChannelCreationArgs args); #endif - async PFileChannel(); #ifdef MOZ_WIDGET_ANDROID async PGeckoViewContentChannel(nullable PBrowser browser, @@ -129,6 +126,12 @@ parent: GeckoViewContentChannelArgs args); #endif + /** + * When a nsFileChannel is opened within the content process, we notify + * "file-channel-opened" in the parent process using this IPC message. + */ + async NotifyFileChannelOpened(FileChannelInfo info); + async RequestContextLoadBegin(uint64_t rcid); async RequestContextAfterDOMContentLoaded(uint64_t rcid); async RemoveRequestContext(uint64_t rcid); diff --git a/netwerk/ipc/moz.build b/netwerk/ipc/moz.build @@ -76,7 +76,6 @@ PREPROCESSED_IPDL_SOURCES += [ IPDL_SOURCES = [ "NeckoChannelParams.ipdlh", "PDocumentChannel.ipdl", - "PFileChannel.ipdl", "PInputChannelThrottleQueue.ipdl", "PProxyAutoConfig.ipdl", "PProxyConfigLookup.ipdl", diff --git a/netwerk/protocol/file/FileChannelChild.cpp b/netwerk/protocol/file/FileChannelChild.cpp @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 sw=2 sts=2 et tw=80: */ -/* 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 "FileChannelChild.h" - -#include "mozilla/dom/ContentChild.h" -#include "mozilla/net/NeckoChild.h" - -namespace mozilla { -namespace net { - -NS_IMPL_ISUPPORTS_INHERITED(FileChannelChild, nsFileChannel, nsIChildChannel) - -FileChannelChild::FileChannelChild(nsIURI* uri) : nsFileChannel(uri) { - mozilla::dom::ContentChild* cc = - static_cast<mozilla::dom::ContentChild*>(gNeckoChild->Manager()); - if (!cc->IsShuttingDown()) { - gNeckoChild->SendPFileChannelConstructor(this); - } -} - -NS_IMETHODIMP -FileChannelChild::ConnectParent(uint32_t id) { - SendSetChannelIdForRedirect(id); - return NS_OK; -} - -NS_IMETHODIMP -FileChannelChild::CompleteRedirectSetup(nsIStreamListener* listener) { - nsresult rv; - - rv = AsyncOpen(listener); - - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - if (CanSend()) { - (void)Send__delete__(this); - } - - return NS_OK; -} - -nsresult FileChannelChild::NotifyListeners() { - uint32_t loadFlags = 0; - GetLoadFlags(&loadFlags); - - LoadInfoArgs loadInfoArgs; - MOZ_ALWAYS_SUCCEEDS( - mozilla::ipc::LoadInfoToLoadInfoArgs(mLoadInfo, &loadInfoArgs)); - - nsCOMPtr<nsIURI> originalURI; - nsresult rv = GetOriginalURI(getter_AddRefs(originalURI)); - NS_ENSURE_SUCCESS(rv, rv); - FileChannelInfo fileChannelInfo(mURI, originalURI, loadFlags, loadInfoArgs, - mContentType, mChannelId); - SendNotifyListeners(fileChannelInfo); - return NS_OK; -} - -} // namespace net -} // namespace mozilla diff --git a/netwerk/protocol/file/FileChannelChild.h b/netwerk/protocol/file/FileChannelChild.h @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 sw=2 sts=2 et tw=80: */ -/* 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/. */ - -#ifndef mozilla__net__FileChannelChild_h -#define mozilla__net__FileChannelChild_h - -#include "nsFileChannel.h" -#include "nsIChildChannel.h" -#include "nsISupportsImpl.h" - -#include "mozilla/net/PFileChannelChild.h" - -namespace mozilla { -namespace net { - -class FileChannelChild : public nsFileChannel, - public nsIChildChannel, - public PFileChannelChild { - public: - explicit FileChannelChild(nsIURI* uri); - - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSICHILDCHANNEL - - protected: - virtual nsresult NotifyListeners() override; - - private: - ~FileChannelChild() = default; -}; - -} // namespace net -} // namespace mozilla - -#endif /* mozilla__net__FileChannelChild_h */ diff --git a/netwerk/protocol/file/FileChannelParent.cpp b/netwerk/protocol/file/FileChannelParent.cpp @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 sw=2 sts=2 et tw=80: */ -/* 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 "nsFileChannel.h" -#include "FileChannelParent.h" -#include "mozilla/Assertions.h" -#include "mozilla/dom/ContentParent.h" -#include "mozilla/net/NeckoParent.h" -#include "nsNetUtil.h" -#include "nsIChannel.h" - -#ifdef FUZZING_SNAPSHOT -# define MOZ_ALWAYS_SUCCEEDS_FUZZING(...) (void)__VA_ARGS__ -#else -# define MOZ_ALWAYS_SUCCEEDS_FUZZING(...) MOZ_ALWAYS_SUCCEEDS(__VA_ARGS__) -#endif - -namespace mozilla { -namespace net { - -NS_IMPL_ISUPPORTS(FileChannelParent, nsIParentChannel, nsIStreamListener) - -NS_IMETHODIMP -FileChannelParent::SetParentListener(ParentChannelListener* aListener) { - // Nothing to do. - return NS_OK; -} - -NS_IMETHODIMP -FileChannelParent::NotifyClassificationFlags(uint32_t aClassificationFlags, - bool aIsThirdParty) { - // Nothing to do. - return NS_OK; -} - -NS_IMETHODIMP -FileChannelParent::SetClassifierMatchedInfo(const nsACString& aList, - const nsACString& aProvider, - const nsACString& aFullHash) { - // nothing to do - return NS_OK; -} - -NS_IMETHODIMP -FileChannelParent::SetClassifierMatchedTrackingInfo( - const nsACString& aLists, const nsACString& aFullHashes) { - // nothing to do - return NS_OK; -} - -NS_IMETHODIMP -FileChannelParent::Delete() { - // Nothing to do. - return NS_OK; -} - -NS_IMETHODIMP -FileChannelParent::GetRemoteType(nsACString& aRemoteType) { - if (!CanSend()) { - return NS_ERROR_UNEXPECTED; - } - - dom::PContentParent* pcp = Manager()->Manager(); - aRemoteType = static_cast<dom::ContentParent*>(pcp)->GetRemoteType(); - return NS_OK; -} - -void FileChannelParent::ActorDestroy(ActorDestroyReason why) {} - -NS_IMETHODIMP -FileChannelParent::OnStartRequest(nsIRequest* aRequest) { - // We don't have a way to prevent nsBaseChannel from calling AsyncOpen on - // the created nsFileChannel. We don't have anywhere to send the data in the - // parent, so abort the binding. - return NS_BINDING_ABORTED; -} - -NS_IMETHODIMP -FileChannelParent::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) { - // See above. - MOZ_ASSERT(NS_FAILED(aStatusCode)); - return NS_OK; -} - -NS_IMETHODIMP -FileChannelParent::OnDataAvailable(nsIRequest* aRequest, - nsIInputStream* aInputStream, - uint64_t aOffset, uint32_t aCount) { - // See above. - MOZ_CRASH("Should never be called"); -} -mozilla::ipc::IPCResult FileChannelParent::RecvNotifyListeners( - const FileChannelInfo& aFileChannelInfo) { - nsCOMPtr<nsIObserverService> obsService = services::GetObserverService(); - if (!obsService) { - return IPC_OK(); - } - - nsAutoCString remoteType; - nsresult rv = GetRemoteType(remoteType); - if (NS_FAILED(rv)) { - return IPC_FAIL(this, "Failed to get remote type"); - } - - nsCOMPtr<nsILoadInfo> loadInfo; - rv = mozilla::ipc::LoadInfoArgsToLoadInfo( - aFileChannelInfo.loadInfo(), remoteType, getter_AddRefs(loadInfo)); - if (NS_FAILED(rv)) { - return IPC_FAIL(this, "Failed to deserialize LoadInfo"); - } - - // Re-create a file channel in the parent process to notify - // file-channel-opened observers. - RefPtr<nsFileChannel> channel; - channel = new nsFileChannel(aFileChannelInfo.uri()); - channel->SetURI(aFileChannelInfo.uri()); - channel->SetOriginalURI(aFileChannelInfo.originalURI()); - channel->SetLoadFlags(aFileChannelInfo.loadFlags()); - channel->SetLoadInfo(loadInfo); - channel->SetContentType(aFileChannelInfo.contentType()); - - rv = channel->SetChannelId(aFileChannelInfo.channelId()); - if (NS_FAILED(rv)) { - return IPC_FAIL(this, "Failed to set channel id"); - } - obsService->NotifyObservers(static_cast<nsIIdentChannel*>(channel), - "file-channel-opened", nullptr); - return IPC_OK(); -} - -mozilla::ipc::IPCResult FileChannelParent::RecvSetChannelIdForRedirect( - const uint64_t& aChannelId) { - nsCOMPtr<nsIChannel> channel; - - MOZ_ALWAYS_SUCCEEDS_FUZZING( - NS_LinkRedirectChannels(aChannelId, this, getter_AddRefs(channel))); - - return IPC_OK(); -} - -} // namespace net -} // namespace mozilla diff --git a/netwerk/protocol/file/FileChannelParent.h b/netwerk/protocol/file/FileChannelParent.h @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=4 sw=2 sts=2 et tw=80: */ -/* 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/. */ - -#ifndef mozilla__net__FileChannelParent_h -#define mozilla__net__FileChannelParent_h - -#include "nsFileChannel.h" -#include "nsIParentChannel.h" -#include "nsISupportsImpl.h" - -#include "mozilla/net/NeckoParent.h" -#include "mozilla/net/PFileChannelParent.h" - -namespace mozilla { -namespace net { - -// In order to support HTTP redirects to file:, we need to implement the HTTP -// redirection API, which requires a class that implements nsIParentChannel -// and which calls NS_LinkRedirectChannels. -class FileChannelParent : public nsIParentChannel, public PFileChannelParent { - public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPARENTCHANNEL - NS_DECL_NSIREQUESTOBSERVER - NS_DECL_NSISTREAMLISTENER - - virtual mozilla::ipc::IPCResult RecvNotifyListeners( - const FileChannelInfo& aFileChannelInfo); - virtual mozilla::ipc::IPCResult RecvSetChannelIdForRedirect( - const uint64_t& aChannelId); - - private: - ~FileChannelParent() = default; - - virtual void ActorDestroy(ActorDestroyReason why) override; -}; - -} // namespace net -} // namespace mozilla - -#endif /* mozilla__net__FileChannelParent_h */ diff --git a/netwerk/protocol/file/moz.build b/netwerk/protocol/file/moz.build @@ -8,8 +8,6 @@ with Files("**"): BUG_COMPONENT = ("Core", "Networking: File") EXPORTS.mozilla.net += [ - "FileChannelChild.h", - "FileChannelParent.h", "nsFileProtocolHandler.h", ] @@ -25,8 +23,6 @@ XPIDL_SOURCES += [ XPIDL_MODULE = "necko_file" UNIFIED_SOURCES += [ - "FileChannelChild.cpp", - "FileChannelParent.cpp", "nsFileChannel.cpp", "nsFileProtocolHandler.cpp", ] diff --git a/netwerk/protocol/file/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp @@ -21,6 +21,7 @@ #include "nsIContentPolicy.h" #include "nsContentUtils.h" #include "mozilla/dom/ContentParent.h" +#include "mozilla/net/NeckoChild.h" #include "../protocol/http/nsHttpHandler.h" #include "nsIFileURL.h" @@ -467,7 +468,7 @@ nsresult nsFileChannel::FixupContentLength(bool async) { // nsFileChannel::nsISupports NS_IMPL_ISUPPORTS_INHERITED(nsFileChannel, nsBaseChannel, nsIUploadChannel, - nsIFileChannel, nsIIdentChannel) + nsIFileChannel, nsIIdentChannel, nsIChildChannel) //----------------------------------------------------------------------------- // nsFileChannel::nsIFileChannel @@ -482,28 +483,59 @@ nsFileChannel::GetFile(nsIFile** file) { } nsresult nsFileChannel::MaybeSendFileOpenNotification() { - nsCOMPtr<nsILoadInfo> loadInfo; - nsresult rv = GetLoadInfo(getter_AddRefs(loadInfo)); - if (NS_FAILED(rv)) { - return rv; + // We never send the notification unless we're in a content process. + if (!IsNeckoChild()) { + return NS_OK; } - bool isTopLevel; - rv = loadInfo->GetIsTopLevelLoad(&isTopLevel); - if (NS_FAILED(rv)) { - return rv; + // Ignore system-principal triggered file channel loads unless they're for a + // toplevel document load. + if (mLoadInfo->TriggeringPrincipal()->IsSystemPrincipal() && + mLoadInfo->GetExternalContentPolicyType() != + ExtContentPolicyType::TYPE_DOCUMENT) { + return NS_OK; } - uint64_t browsingContextID; - rv = loadInfo->GetBrowsingContextID(&browsingContextID); - if (NS_FAILED(rv)) { - return rv; - } + uint32_t loadFlags = 0; + MOZ_ALWAYS_SUCCEEDS(GetLoadFlags(&loadFlags)); - if ((browsingContextID != 0 && isTopLevel) || - !loadInfo->TriggeringPrincipal()->IsSystemPrincipal()) { - NotifyListeners(); + LoadInfoArgs loadInfoArgs; + MOZ_ALWAYS_SUCCEEDS( + mozilla::ipc::LoadInfoToLoadInfoArgs(mLoadInfo, &loadInfoArgs)); + + FileChannelInfo fileChannelInfo(mURI, nsBaseChannel::OriginalURI(), loadFlags, + loadInfoArgs, mContentType, mChannelId); + gNeckoChild->SendNotifyFileChannelOpened(fileChannelInfo); + return NS_OK; +} + +/* static */ +nsresult nsFileChannel::DoNotifyFileChannelOpened( + const nsACString& aRemoteType, + const mozilla::net::FileChannelInfo& aFileChannelInfo) { + nsCOMPtr<nsIObserverService> obsService = components::Observer::Service(); + if (!obsService) { + return NS_OK; } + + nsCOMPtr<nsILoadInfo> loadInfo; + nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo( + aFileChannelInfo.loadInfo(), aRemoteType, getter_AddRefs(loadInfo)); + NS_ENSURE_SUCCESS(rv, rv); + + // Re-create a file channel in the parent process to notify + // file-channel-opened observers. + RefPtr<nsFileChannel> channel; + channel = new nsFileChannel(aFileChannelInfo.uri()); + channel->SetURI(aFileChannelInfo.uri()); + channel->SetOriginalURI(aFileChannelInfo.originalURI()); + channel->SetLoadFlags(aFileChannelInfo.loadFlags()); + channel->SetLoadInfo(loadInfo); + channel->SetContentType(aFileChannelInfo.contentType()); + MOZ_ALWAYS_SUCCEEDS(channel->SetChannelId(aFileChannelInfo.channelId())); + + obsService->NotifyObservers(static_cast<nsIIdentChannel*>(channel), + "file-channel-opened", nullptr); return NS_OK; } @@ -554,8 +586,20 @@ nsFileChannel::SetChannelId(uint64_t aChannelId) { return NS_OK; } -nsresult nsFileChannel::NotifyListeners() { - // Nothing to do here, this will be handled in - // FileChannelChild::NotifyListeners. +//----------------------------------------------------------------------------- +// nsFileChannel::nsIChildChannel + +NS_IMETHODIMP +nsFileChannel::ConnectParent(uint32_t aId) { + if (!IsNeckoChild()) { + return NS_ERROR_NOT_IMPLEMENTED; + } + + gNeckoChild->SendConnectBaseChannel(aId); return NS_OK; } + +NS_IMETHODIMP +nsFileChannel::CompleteRedirectSetup(nsIStreamListener* aListener) { + return AsyncOpen(aListener); +} diff --git a/netwerk/protocol/file/nsFileChannel.h b/netwerk/protocol/file/nsFileChannel.h @@ -8,13 +8,19 @@ #define nsFileChannel_h__ #include "nsBaseChannel.h" +#include "nsIChildChannel.h" #include "nsIFileChannel.h" #include "nsIUploadChannel.h" +namespace mozilla::net { +class FileChannelInfo; +} + class nsFileChannel : public nsBaseChannel, public nsIFileChannel, public nsIUploadChannel, - public nsIIdentChannel { + public nsIIdentChannel, + public nsIChildChannel { public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIFILECHANNEL @@ -22,11 +28,16 @@ class nsFileChannel : public nsBaseChannel, NS_FORWARD_NSIREQUEST(nsBaseChannel::) NS_FORWARD_NSICHANNEL(nsBaseChannel::) NS_DECL_NSIIDENTCHANNEL + NS_DECL_NSICHILDCHANNEL explicit nsFileChannel(nsIURI* uri); nsresult Init(); + static nsresult DoNotifyFileChannelOpened( + const nsACString& aRemoteType, + const mozilla::net::FileChannelInfo& aFileChannelInfo); + protected: ~nsFileChannel() = default; @@ -45,7 +56,6 @@ class nsFileChannel : public nsBaseChannel, // Implementing the pump blocking promise to fixup content length on a // background thread prior to calling on mListener nsresult ListenerBlockingPromise(BlockingPromise** promise) override; - virtual nsresult NotifyListeners(); uint64_t mChannelId = 0; private: diff --git a/netwerk/protocol/file/nsFileProtocolHandler.cpp b/netwerk/protocol/file/nsFileProtocolHandler.cpp @@ -13,8 +13,6 @@ #include "nsNetUtil.h" -#include "FileChannelChild.h" - #include "mozilla/net/NeckoCommon.h" // URL file handling, copied and modified from @@ -169,12 +167,7 @@ nsFileProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo, nsIChannel** result) { nsresult rv; - RefPtr<nsFileChannel> chan; - if (mozilla::net::IsNeckoChild()) { - chan = new mozilla::net::FileChannelChild(uri); - } else { - chan = new nsFileChannel(uri); - } + RefPtr<nsFileChannel> chan = new nsFileChannel(uri); // file URLs with hostnames should be considered an error // Before bug 1507354 file URLs ignored the host part. So we intentionally